winapi

ZwQuerySystemInformation / NtQuerySystemInformation - System Information Class 5

Hi, For 32-bit Windows, following declaration of _SYSTEM_PROCESSES structure ( System Information Class 5 ) with ZwQuerySystemInformation works fine for my purpose to construct process tree. typedef struct _SYSTEM_PROCESSES { // System Information Class 5 ULONG NextEntryDelta; ULONG ThreadCount; ULONG ...

C basic datatype problem - const char * to LPCTSTR

#include "stdafx.h" #include "string.h" #include "windows.h" bool SCS_GetAgentInfo(char name[32],char version[32], char description[256], const char * dwAppVersion) { strcpy(name,gName); strcpy(version,gVersion); strcpy(description,gDescription); notify(dwAppVersion); return true; } void notify(const char * msg) { ...

How to speed up offscreen OpenGL rendering with large textures on Win32?

I'm developing some C++ code that can do some fancy 3D transition effects between two images, for which I thought OpenGL would be the best option. I start with a DIB section and set it up for OpenGL, and I create two textures from input images. Then for each frame I draw just two OpenGL quads, with the corresponding image texture. The ...

Construct Process Tree in Windows

Hi, To construct a process tree in Windows "C" given a PID, which one is a good approach to go for Win2k, XP, Windows Server 2008, Windows 7. ZwQuerySystemInformation NtQuerySystemInformation CreateToolhelp32Snapshot I remember ToolHelp had issue in leaking memory for win2k. Please correct me if I am wrong. And using ZwQuerySystemI...

How to find the most recently edited file in NSIS

I have an NSIS script that pulls other installers from a local share. Some of these update very often. Rather than push out a new NSIS script every time, I'd like the script to look for the most recent installer matching a pattern in a certain directory. Is there a plugin or a Windows API that I can call from NSIS to do this? ...

How can one detect changes in a directory across program executions?

I am making a protocol, client and server which provide file transfer functionality similar to FTP (among other features). One difference between my protocol and FTP is that I would like to store a copy of the remote server's directory structure in a local cache. The server will only be running on Windows (written in C++) so any applic...

When a window closes, do my destructors get called?

If a window is closed (like with sending WM_CLOSE), are the destructors of objects called? I followed my source code with a break point in that situation, but the compiler doesn't seem to pass through my destructor. Is the program closed without calling any destructors? ...

Sending a specific SCSI command to a SCSI device in Windows

Hi, Does windows have specific interface by which I can send a specific scsi command such Inquiry to scsi device ? I searched the net, found passing reference to SCSI Pass Through interface. But Its very Vague. Is there any documentation for that API on how to use it?? ...

GetVolumePathName() failed with ERROR 158: ERROR_NOT_LOCKED

GetVolumePathName() API failed and GetLastError() returned ERROR 158: ERROR_NOT_LOCKED. What is the reason for this error and how to overcome it? ...

Win32 API stack walk with MinGW/MSYS?

Hi all, i've to develop a stack trace walk to our win32 API plattform support to catch any exception with a behaviour of a JAVA stacktrace. Actually we got a full functional implementation for Linux plattforms. First i've tried to implement a stackwalk using the win32 CaptureStackBackTrace API mechanism. But this method is not integrat...

Can a Windows app compiled using the Unicode character set use a DLL compiled as Multi-Byte?

I suspect the answer is "no", since when I go to include the header, the "T" macros will be defined to use (wchar_t *), but the DLL is expecting (char *). However, I was wondering whether Windows did any on-the-fly transcoding between modules that would make this magically work (assuming simple ASCII characters). ...

OpenGL polygon z buffer problem

Here is a quick and dirty GLUT based C++ program for windows that draws two rectangles, blue and green on a flat red background. Pressing 'a' or 'z' makes them orbit along the X axis in either direction. My problem is that if I enable GL_DEPTH_TEST, it sometimes draws one rectangle, sometimes two or sometimes just the background but ne...

How can I make the Win32 API window more modern looking?

Hey, I ordered Programming Windows Fifth Edition a few days ago, and started working with it. I'm starting to learn the win32 api, however, I got a question. The windows do not look modern winxp/win vista/win 7 style at all. How do I fix this? It currently looks like this, crap font and all. Thanks in advance! Machiel ...

Using Ruby, Perl, or Python, how to "Move the window 'Firefox' to coordinate (0,0) on screen and resize it 1024 x 768"?

Can it be moved by Window Title as well as exe name? Other info on moving it in another language could be helpful. Update: some Perl sample can be found in Win32::GuiTest but there seems to be no resize or move functions. ...

How to capture stdout from another process in win32 without latency?

Hi ! What I'ld like to do is similar to what VS does in its output window or other editors in their tool windows: Start another process B from my process A and capture its stdout/stderr output. So far, I got it working with CreatePipe(), but for some reason, the output of B doesn't arrive at B right when it gets written. It behaves mor...

How can I determine if process is 32 or 64Bit from a handle?

How can I get the information from a Process handle acquired using OpenProcess whether a Process is 32 or 64 Bit? ...

How do I make the "show/hide desktop icons" setting take effect?

The code below calls SHGetSetSettings function to hide desktop icons but it just unchecked "Show desktop icons" from the view menu. I called SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_FLUSHNOWAIT, nil, nil); to update the desktop but that doesn't work? var lpss: SHELLSTATE; begin lpss.Data := High(cardinal); lpss.Data2 := Low(cardi...

What is the Linux version of GetTickCount?

Possible Duplicate: Equivalent to GetTickCount() on Linux What is the Linux version of GetTickCount? http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx ...

In Ruby's Win32API.new, isn't 'L' the same as 'I', and what about 'N' or 'P'?

In some documentation, Ruby's Win32API has 'L' and 'N' to specify a "number"... and in some documentation, 'L' is "long". Is 'N' deprecated, and isn't 'L' the same as 'I' actually? A "number" is somewhat not so specific. In http://rubyforge.org/docman/view.php/85/3463/API.html#M000001 There is no specifying a boolean parameter as '...

Is there any Windows API that can "normalize" or "maximize" a window?

I was using Ruby's Win32API to MoveWindow to move a window and resize it. But if the window is minimized, it won't show. SetWindowPos works too, and has a flag to hide or show the window, but it is to only make a window visible or invisible, not about minimizing or normalizing. I also tried SetForegroundWindow and SetActiveWindow and ...