winapi

Is there a way to resolve a .lnk target that works for links that end up in c:\windows\installer ?

The usual way to resolve lnk involve using WShell.WshShortcut or IShellLink that way : var WshShell = WScript.CreateObject("WScript.Shell"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\some-shortcut.lnk"); WScript.Echo(oShellLink.TargetPath) But there are links that can't be resolved that way : the resolution end up in c:...

How to add a system "windows hook" so as to be notified of windows being created/activated?

Tried a bunch of things but I can't get it to work consistently amid my taskbar being nuked and other supernatural effects on my desktop UI. Tried using a open-library http://mwinapi.sourceforge.net/ first. Although it worked nicely as an OO layer for enumerating windows and stuff. It couldn't do hooks properly Next stop was Dino E.'s...

WaitForSingleObject( )

I have got myself stuck into a really amazing issue here.The code is like as below. class A { public: A(){ m_event = CreateEvent(NULL, false, false, NULL); // create an event with initial value as non-signalled m_thread = _beginthread(StaticThreadEntry, 0, this); // create a thread } stat...

Is it possible to reasonably workaround an antivirus scanning the working directory?

My Win32 application performs numerous disk operations in a designated temporary folder while functioning, and seriously redesigning it is out of the question. Some clients have antivirus software that scans the same temporary directory (it simply scans everything). We tried to talk them into disabling it - it doesn't work, so it's out ...

Blt() to create a layer effect. Not working. Am I using the wrong logical function or something?

I have one window that is drawn to by various objects to create a layered effect (think of a heads up display where one object draws a compass, the other draws the grid lines, another the altimeter reading etc). So, each object has a black memory bitmap that it draws to. When I call that objects Draw function, the memory bitmap is blitte...

Is it possible to debug a userland application from kernel land ?

Hey, I'm debugging some win32 application which has loads of anti-debugging, I've tried different stealth options w/ olly and IDA but none of them seem to work. I was wondering if it's possible to debug this userland app from kernelland so the app won't know it's being debugged ? if so - which debugger should I use ? ...

Sending string data between threads (Win32)

Hi all, This is a fairly straightforward question, I'm basically looking for a 'best practice' approach to what I'm trying to do. I have a Win32 GUI application which starts up a worker thread to do a bunch of blocking calls. I want this thread to send string messages back to the GUI so they can be displayed to the user. Currently I'm...

GetPrivateProfileSectionNames always returns 0

GetPrivateProfileSectionNames always returns 0, even when the file is a valid ini file. What can be the reason? Thanks in advance! ...

Page error 0xc0000006 with VC++

I have a VS 2005 application using C++ . It basically importing a large XML of around 9 GB into the application . After running for more than 18 hrs it gave an exception 0xc0000006 In page error. THe virtual memory consumed is 2.6 GB (I have set the 3GB) flag. Does any one have a clue as to what caused this error and what could be the s...

How can I get response information from IE programatically?

I want to know what are different ways to get the response code information when we visit any page in IE by using Windows API or some interfaces using C++? I think some ways include 1)Using BHO: But I think that will give HTML information.Can we get information related to HTTP here like response codes? 2)Using Async Pluggable Prot...

Shrink the bitmap to required dimension

Hi, I have a bitmap of large dimension (2000 x 2000) i need to shrink that bitmap to a small dimension (150 x 150). i have written a code for it, but its not working. Can anybody help in finding the problem? The problem is the destination bitmap is just blank. I am selecting wrong DC's? I have made sure that both the source and destinat...

Is there a way to change the preferred base address of a dll once it's compiled?

I'd like to modify the base address of a few compiled dlls I'm using to move them out of the middle of the virtual space and help with big allocations. Anybody knows of a tool to do that? If it's doable in the loader it seems it would be possible do to it permanently in the dll file. ...

Is it possible to intercept WIN32 Exceptions for 3rd party applications?

Is it possible to intercept WIN32 exceptions for 3rd party applications? I have a particularly bad behaving 3rd party application for which I'm try to intercept unhandled exceptions so I can know that I need to kill the process but I'm finding it hard to find anything about this subject that seems to fit what I need. Any help would be...

Win32 API to tell whether a given binary (EXE or DLL) is x86, x64, or ia64

Hello, I am trying to find a programmatic way to tell if a binary is x86, x64, or ia64. Platform: Windows. Language: c/c++. Background: Before trying to load a third-party dll, I need to find out its bitness. Appreciate any pointers. ...

Trouble using ReadFile() to read a string from a text file

Hello everyone, How can I make the code below to read correct text. In my text file has Hello welcome to C++, however at the end of the text, it has a new line. With the code below, my readBuffer always contains extra characters. DWORD byteWritten; int fileSize = 0; //Use CreateFile to check if the file exists or not. HANDLE hFile =...

Building windows forms in C

So far, I've been able to create a window in C, and add a button and edit box to that window. But, where can I find an exhaustive list of the system classes for all the form controls? I can't remember where I found BUTTON and EDIT--is there a LABEL? LISTBOX? CHECKBOX? COMBOBOX? etc. Then, how would I use those built in windows functions...

Converting argv back to a single string

I'm writing a (Win32 Console) program that wraps another process; it takes parameters as in the following example: runas.exe user notepad foo.txt That is: runas parses user and then will run notepad, passing the remaining parameters. My problem is that argv is broken down into individual parameters, but CreateProcessAsUser requires a...

XY-Bitmap in an MFC application

I am using a library that has been ported to Windows from Linux. The library is used to read a terrain database and up to this point it has been used for simple queries; elevation, line-of-sight, etc. But it also has the ability to create bitmaps of the underlying terrain file that I'd like to take advantage of... The function I am us...

Suppress keystrokes to dialog

I have added a keyboard hook for a dialog that I don't control (it runs its own DialogProc Function in a library with closed source). I'm able to capture the key strokes, but the key stroke is always sent the dialog. This causes error beeps as well as some weird behavior. Installing the hook: hKeyHook=SetWindowsHookEx(WH_KEYBOARD, KeyH...

Making DDE calls from Java

Wondering if anyone has experience and/or sample code for making DDE calls from Java. I've done DDE using win32 calls from the stddde library (DdeInitialize, DdeClientTransaction), and could write a JNI wrapper for this, but I was thinking that it might be nice to do it from JNA I also have some concerns about the fact that DDE calls n...