winapi

Are there any downsides to using UPX to compress a Windows executable?

I've used UPX before to reduce the size of my Windows executables, but I must admit that I am naive to any negative side effects this could have. What's the downside to all of this packing/unpacking? Are there scenarios in which anyone would recommend NOT UPX-ing an executable (e.g. when writing a DLL, Windows Service, or when targeting...

How do I pass pointers to a DLL using Win32:API?

Hi, I am trying to passing in 3 pointers to a DLL function. I have: { $code=1; $len=100; $str=" " x $len; $function = new Win32::API(DLLNAME,'dllfunction','PPP','V'); $function->Call($code,$str,$len); } The DLL is defined as void dllfunction(int* a, char* str, int* len); The DLL will modify all the variables pointed by the three ...

How to get file time by name in windows?

Windows has GetFileTime API which allows getting file time information by open file handle. What I wanted to know is, if it is possible to get this information by file name without opening the file explicitly. And if possible is it also applicable to Windows Mobile platform? ...

Windows process structure: How to store user information?

Hi, I want to store some information in the EPROCESS structure of the process in windows NT kernel. My aim is that when winlogon is called I want to assign a unique value to the next process based on which user logs in. But I do not know where to store this unique ID. I have tried and succeeded in modifying some information (like the t...

Viewing registers in a crash dump

Is there a way to view the register contents in each stack frame in a crash dump? The registers window seems to contain the registers when the exception occurred but it would be useful to be able to see their contents in each stack frame. ...

How to reload a 3rd party DLL that crashes often

I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have. Unfortunately this DLL crashes now and then and I've been tasked to make it "reload" automagically. I'm not too sure about how to proceed to get best results. My project uses C++.Net 2.0 (2005). I'm wrapping the 3rd party stuff in a separate DLL. I'...

c++ using getdibits and setdibits

How do you use GetDIBits and SetDIBits in win32 c++? ...

How to duplicate socket for target process under different user

I've hit upon a problem with WSADuplicateSocket, which I'm using to duplicate a socket for use by a different process. It works find when both processes are running under the same Windows user, but fails with error code 10022 (WSAEINVAL) when they are running under different users. Specifically, the process calling WSADuplicateSocket is...

Looking for a replacement for windows messages used in inter-process communication in Delphi

Hi a have a multithread application (MIDAS) that makes uses of windows messages to communicate with it self MAIN FORM The main form receives windows messages sent by the RDM LogData(‘DataToLog’) Because windows messages are used they have the following attributes 1) Received messages are Indivisible 2) Received messages are Queued ...

Make a WPF Window behave like a Context Menu (show/hide it properly)

I want to make a WPF Window that behaves like a context menu. So, for instance - when I show the wpf window, I want it to be the topmost window and from there on out, if the user clicks anything outside of that window I want the window to be hidden again. So far I have tried quite a few techniques but the only one that I found that kin...

C++ developing a GUI - classes?

I do have to say I'm fairly inexperienced when it comes to C++, don't be too harsh on me. Recently stumbled unto the wonders of the win32 API and have chosen to practice using it (I'd rather not use MFC/wxWidgets/etc at this point, just for educational purposes). Well, my real question is: How do you properly code your win32 GUI stuff ...

Increase number of characters in filename field of GetOpenFileName file selection dialog

Our app allows multiple files to be selected in a file selection dialog which is shown via the GetOpenFileName function (this question also applies to folks using CFileDialog, etc...) There appears to be a limit to the number of characters that can be typed into the filename field (259 seems to be the magic number - not sure why). We h...

Windows not sizable and without caption.

I want to to create a window not sizable and without caption like vista sndvol.exe DlgSimpleVolume ...

How do I detect the DLLs required by an application?

In a nutshell: I want to do the same thing "Dependency Walker" does. Is there any Win32 API function which can enumerate the dependencies of a EXE and/or DLL file? And is there any safe way to detect dependencies on ActiveX classes? (I doubt it is possible, but who knows ...) EDIT: I'm aware of available tools which provide the same c...

Getting access denied with GetEffectiveRightsFromAcl()..?

I’m attempting to check the rights on a particular file for a specific trustee and am using the win32 API GetEffectiveRightsFromAcl(). When the file is accessible by a domain group, the function returns 5 (Access Denied) when a local account (admin or other) is used to execute the function. These three statements summarize the behavior...

How to know if the local Area Connection is available

Dear all i'm using Win XP and i want to know if the local area is available or not ?!? and if i'm using another OS would that affect on my code ??! thnx in advance ...

Detect windows logout in Python

How can I detect, or be notified, when windows is logging out in python? Edit: Martin v. Löwis' answer is good, and works for a full logout but it does not work for a 'fast user switching' event like pressing win+L which is what I really need it for. Edit: im not using a gui this is running as a service ...

System Icons Retrieval in C# 1.0 and Alpha Channels

In a .NET 1.0 C# application, I wish to display a list of files and folders in a listview control. I want to programmatically retrieve from windows the icons for the files or folders to display them appropriately in the list view. At present, I am using the Windows API Shell32.dll, but am having problems with the alpha channel in the ic...

Convert bitmap to PNG in-memory in C++ (win32)

Can I convert a bitmap to PNG in memory (i.e. without writing to a file) using only the Platform SDK? (i.e. no libpng, etc.). I also want to be able to define a transparent color (not alpha channel) for this image. The GdiPlus solution seems to be limited to images of width divisible by 4. Anything else fails during the call to Save()....

Getting a list of 3rd party modules with Windbg?

I'm using windbg to examine some crash dumps sent in by an app. There seems to be some correlation between a crash I'm seeing and having a certain 3rd party DLL loaded into the process (a flaky Winsock LSP, I suspect). To make this sort of analysis easier in the future, is there a windbg script that would just show me a list of modules...