winapi

Determine the registered application for an extension

I've got a file extension and I'd like to get the name of the application (if there is one) that will be invoked when I ShellExecute a file of that type. This is a WTL/C++ app. Is there any sample code out there that does this? Thanks! ...

Any Tutorials for Win32 SDK Programming?

What are some good websites for Win32 SDK programming tutorials? ...

Cheating in online games: Is it possible to prevent one Win32 process from inspecting/manipulating another's memory?

I play the online game World of Warcraft, which is plagued by automated bots that inspect the game's allocated memory in order to read game/player/world state information, which is used to mechanically play the game. They also sometimes write directly to the game's memory itself but the more sophisticated ones don't, as far as I know. T...

Microsoft Active Accessibility super sloooww when enumerating controls. Help!

I am using active accessibility framework to enumerate all the controls for a given program. Problem is that when I traverse the tree of controls, it takes forever on complex applications like explorer or visual studio. Simple applications take about a second but large ones with lots of controls can take 10 seconds. Anyone experience thi...

What are the different calling conventions in C/C++ and what do each mean?

There are different calling conventions available in C/C++ stdcall, extern, pascal etc. How many such calling conventions are available and what do each mean? Are there any links that describe these? ...

WIN32 memory issue (differences between debug/release).

I'm currently working on a legacy app (win32, Visual C++ 2005) that allocates memory using LocalAlloc (in a supplied library I can't change). The app keeps very large state in fixed memory (created at the start with multiple calls to LocalAlloc( LPTR, size)). I notice that in release mode I run out of memory at about 1.8gb but in debug i...

Can I check to see if a COM port can be opened without actually opening it?

Typically, on a PC, there is some non-standard set of COM ports available for use by a terminal emulator. I would like to be able to scan ports COM1-COM32 to see which (if any) of those ports can be opened as a serial port. I can do this be simply calling CreateFile() on all those ports; however, then I actually have to open/close (and...

What's wrong with GetUserName Win32 API?

I'm using GetUserName Win32 API to get the user name of my computer, but I found the user name is different (uppercase vs. lowercase only) when using my VPN connection into work when I was at home. I’m wondering if the VPN client or other software could be affecting the username? ...

Which is the best tool to test for Memory leak in Win32/COM application?

I'm looking for a tool which can monitor a running application (Win32/COM) for a long duration (1-3 days) and detect memory leaks if any. Any suggestions? It is a .NET Windows application calling lots of unmanaged code. ...

OpenGL text position under Windows

Hello all, I am developing an OpenGL application that has two working modes: windowed mode and full screen. The app displays several graphic objects using OpenGL and writes some text strings using that same API. The program displays the texts strings in its intended positions when running as a windowed application, but when running full...

SystemParametersInfo behaves differently on Vista and XP

I am trying to find the default system font size using SystemParametersInfo() with SPI_GETNONCLIENTMETRICS. While on Vista the LOGFONT structures inside the returned NONCLIENTMETRICS actually have the correct font height in lfHeight, when I run the exact same app on XP, lfHeight (and lfWidth) are always zero. Why is that so, and what i...

CreateFile Win32 API Call with OPEN_ALWAYS failed in an Odd Way

We had a line of code if( !CreateFile( m_hFile, szFile, GENERIC_READ|GENERIC_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL ) ) { DWORD dwErr = GetLastError(); CString czInfo; czInfo.Format ("CMemoryMapFile::OpenAppend SetFilePointer call failed - GetLastError returned %d", dwErr); LOG(czInfo); retu...

Does SetupDiGetClassDevs work with device instance IDs as documented?

According to MSDN documentation, SetupDiGetClassDevs can be passed a device instance ID to obtain a device information set for a specific device: To return only a specific device, set the DIFCF_DEVICEINTERFACE flag and use the Enumerator parameter to supply the device instance ID of the device. I get the device instance ID by...

how can I programatically get the name of an application?

I'm developing an orthogonal. Reporting/Logging system for several applications and was wondering how I can get an applications name on Windows using C/C++? the obvious requirement is I can't get it as a commandline argument or have the application tell me directly so I need to query the OS. Thanks for any ideas! ...

Is there any Win32 API to trigger the hibernate or suspend mode in windows?

Is there any Win32 API to put the machine into hibernate or suspend mode? I read MSDN and found that WM_POWERBROADCAST message gets broadcasted when power-management events occur. I thought of simulating the same with PostMessage(WM_POWERBROADCAST). Is this the correct way of doing or any Win32 API exists to achieve this? ...

Asynchronous Windows Console input whilst outputting

Hey all, Long time reader, first time poster :D I'm having issues trying to read input whilst outputting at the same time. I need a server console for my game which can receive input whilst outputting and not mess up the buffer. For example, I'm typing "Hello world" and in the process, player deaths, kills, etc. are being outputted in...

File Attribute is read only when its folder is read only and the file is not.

Anyone has any idea?? GetFileAttributes returns 32 (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_ARCHIVE). The file is C:\WINDOWS\system32\drivers\etc\hosts. Thanks a lot! ...

Monitoring API calls

I am doing some reverse engineering and want to know which APIs are called from the executable. I am mostly interested in the APIs called on a particular Windows system DLL. I guess one way to do that is to get all APIs exposed from the DLL using dumpbin and put breakpoints on all those from Windbg. Any other approach? This seems like...

How do I stop a command prompt from appearing in a Win32 C application?

I really have no idea why this is happening... I created a win32 application in emacs, and whenever I make it and run it (not through the command prompt), a command prompt window pops up under the window. If I build a win32 application in Code::Blocks, and just run its default template, then it runs without a command prompt window. I loo...

Getting a crash inside SHBrowseForFolder()

Hi All, I am getting a crash inside win32 fn:: SHBrowseForFolder(). The code is as follows: BROWSEINFO bi = {0}; TCHAR szDisplayName[MAX_PATH]; szDisplayName[0] = ' '; bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = szDisplayName; bi.lpszTitle = _T("Please se...