windows

Device Driver IRQL and Thread/Context Switches

Hi, I'm new to Windows device driver programming. I know that certain operations can only be performed at IRQL PASSIVE_LEVEL. For example, Microsoft have this sample code of how to write to a file from a kernel driver: if (KeGetCurrentIrql() != PASSIVE_LEVEL) return STATUS_INVALID_DEVICE_STATE; Status = ZwCreateFile(...); My qu...

How can I get python in the command prompt on Windows?

I have just installed Python on my Windows 7. I thought that after that I will be able to run python on the command prompt but it is not the case. After the installation I also found out that I can run the python command shell. This is nice. But what should I do if I want to save my program in a file and then I want to run this program (...

How do you make copy protected CDs?

I am working on making educational CDs. I require medium level copy protection code which may not be easily breakable by "non experts", similar to that in game CDs, so you have to have the CD in the drive while playing and have to enter key while installing it. ...

Window Icon of Exe in PyQt4

I have a small program in PyQt4 and I want to compile the program into an Exe. I am using py2exe to do that. I can successfully set icon in the windows title bar using the following code, but when i compile it into exe the icon is lost and i see the default windows application. here is my program: import sys from PyQt4 import QtGui cl...

How do I create a batch file that will search all subdirectories for filetypes and copy them to a folder?

This is what I have: for /R %i in (*.swf) do copy %i C:/testfolder/ I get the error "The system cannot find the file specified. It's finding the .swf's just fine, but it's not copying them. ...

How to set "Run this program as an administrator" programatically.

I'm having a problem with good ol' bdeadmin.exe in Vista. First, let's get the predictable responses out of the way: "You should not require your application to be elevated." This one does. C'est la vie. "You need to embed a manifest file." It is already compiled, it is many years old, the company that created it has no intention of do...

Manage Z-Orders of windows in different threads/message loops?

I've got a C# SCSF application using Telerik WinForms UI conrols that has some long running UI operations that lock up the main UI thread for a few seconds. I do as much background processing on background threads as I can, However some of the databinding and list loading operations cause up to a 5 second halt on the UI Thread. In orde...

How to retreve the Interface ID of a COM class so that It can be passed to CoCreateInstance?

I want to programaticly retreive the Interface ID for any or any class so that I can pass it to CoCreateInstance. Any help is very much so appreciated!! See "How Do I Get This" below: HRESULT hResult; CLSID ClassID; void *pInterface; if(!(hResult = SUCCEEDED(CoInitialize(NULL)))) { return 1; } if(S_OK == CLSIDFromProgID(OLESTR("S...

Is timespec not defined in Windows?

It seems weird to me that this answer is hard to find. I've included time.h and ctime, but vc9 is still complaining about an undefined type 'timespec'. I've searched here, MSDN, and the web (even with the exact compiler error), but I can't find the answer... maybe it's just lost in the noise. Here's the exact error: error C2027: use o...

Can you create a windows explorer plugin using .net?

For example I wanted to create a simple plugin that supports multi-rename. I was thinking of something like a button that could be added to toolbar in windows explorer. But how do I do that and also can this be done in .net? ...

Book for a Windows Application

Hello everybody. I want to create an small GUI Windows application that looks like all the other usual appz. I am searching for a book that describes the whole procedure. Let's say an address book application that can be have a small database, minimized in the task bar, doing things in the background and so on. I don't care for the l...

Listing directory contents using C and Windows

I'm looking to list and store the contents of a directory in a struct using C on Windows. I'm not necessarily looking for anyone to write out the code I'm looking for, rather point me in the right direction when it comes to which library I should be looking at. I've been Googling for a few hours now and all I'm finding is C#, C++ solu...

What (software) usb sniffers are available for windows?

Are there any software drivers for windows 7 (64-bit) that can report the data transferred between some application software and a usb device? I have tried snoopy (http://sourceforge.net/projects/usbsnoop/) but I can't get it working. Possibly I would need to go down the route of installing an earlier version of windows. Any other sug...

C89: getaddrinfo() on Windows?

I'm new to C89, and trying to do some socket programming: void get(char *url) { struct addrinfo *result; char *hostname; int error; hostname = getHostname(url); error = getaddrinfo(hostname, NULL, NULL, &result); } I am developing on Windows. Visual Studio complains that there is no such file if I use these incl...

How can I slow down a TCP connection on Windows?

I am developing a Windows proxy program where two TCP sockets, connected through different adapters are bridged by my program. That is, my program reads from one socket and writes to the other, and vice versa. Each socket is handled by its own thread. When one socket reads data it is queued for the other socket to write it. The probl...

new computer, git pull origin is asking for a password

on my new computer, I setup git and my putty.exe and ssh key etc. just fine. So I do a: git pull origin and then at the command prompt, I am asking for a password. I have no idea what password it wants, and then it also asks for my server's password after a few failed attempts at the first password. it asks for: blahblah@serveradm...

Impersonating a user from a Java Servlet

Given a Java Servlet (running on a Windows server) which creates a new process via ProcessBuilder, what are my options for having that new process run as the user who invoked the original web request to the servlet? To clarify, what I want is that something like ProcessBuilder pb = new ProcessBuilder("whoami"); Process p = pb.start();...

Opening fstream with file with Unicode file name under Windows using non-MSVC compiler

Hello, I need to open a file as std::fstream (or actually any other std::ostream) when file name is "Unicode" file name. Under MSVC I have non-standard extension std::fstream::open(wchar_t const *,...)? What can I do with other compilers like GCC (most important) and probably Borland compiler. I know that CRTL provides _wfopen but it ...

PAGE_FAULT_IN_NONPAGED_AREA error at KeWaitForSingleObject function.

Can this codes cause a problem?(PAGE_FAULT_IN_NONPAGED_AREA) KEVENT waitEvent; //allocate on stack LARGE_INTEGER timeout; KeInitializeEvent(&waitEvent, NotificationEvent, FALSE); KeResetEvent(&waitEvent); timeout.QuadPart = -(100 * 10000); // 100 ms while(pDataChannel->useCount) { KeWaitForSingleObject(&waitEvent, Executive, Kerne...

How to convert UNC to local path

I'm looking for a method to get corresponding local path for a given UNC path. Microsoft provides a small library CheckLCL for this purpose. This library is not supported on all Windows versions. Does anybody know any open source method for this? There is also MAPI function ScLocalPathFromUNC, but am not sure if it works on all platfor...