winapi

applying texture another problem directx c++

ok i got everything working. the texture only applys for two sides only of the cube the other sides won't display the correct texture. here is my code // Monopoly.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "Monopoly.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; ...

Best practice of sending array from native code to managed code(C++/CLI)?

I'm writing a win32 dll for read/write USB HID device. The data for exchange is a 64 byte unsigned char array. The client program is written in C++/CLI. In order to achieve max speed and minimum overhead, I need an efficient way to sending the array to managed client. There are two options I can think of right now: Native: use PostMe...

What happens when windows encounters an unknown instruction in a binary?

We have a binary compiled with SSE3 optimizations which end up using the instruction LDDQU. Now when this code is executed on a Windows system (Single core, XP2) which has only SSE1,2 support (as seen through CPU-Z tool) then application crashes. (924.4f0): Invalid lock sequence - code c000001e (first chance) ... 001700a10 f20ff00430 ...

Making TAB key work on Windows dialog

I'm working on a Windows project with a simple dialog created with CreateWindowEx() it contains multiple panes loaded with CreateDialog() to load the layout from a resource file. On the child panes there are a number of controls including text boxes and buttons which I would like to use TAB to navigate around but all I get is the Windows...

Lightest synchronization primitive for worker thread queue

I am about to implement a worker thread with work item queuing, and while I was thinking about the problem, I wanted to know if I'm doing the best thing. The thread in question will have to have some thread local data (preinitialized at construction) and will loop on work items until some condition will be met. pseudocode: volatile bo...

Setting tab order of item on the dialog

Hi, I am facing a problem in setting the tab order in a dialog box. To set the tab order I have used the function SetWindowPos(). Initially it will be focused to one of the dialog item, but if I press tab it will not change the focus to the other items on the dialog box. Please help he to fix the problem. bellow is the code... HWND...

COM + WaitForSingleObject

I've been trying to find a good architecture for one application for the last few days, and after some research I'm finally stuck, and the reason is COM. The app in question will have multiple GUI threads, and they will schedule work items for worker thread. The worker thread will initialize COM via CoInitialize(NULL);, create few COM c...

Manipulating a scroll bar window in another application

We're "automating" a third part application by writing a script to mimick using input. We're able to mouse click, send keystrokes etc by using win32 calls, but I'm having trouble automating manipulating a scroll bar. I've found the window who's location matches the visual location of the scrollbar, so I'm pretty sure I have the window h...

Why doesn't narrator report itself as a screen reader to windows?

Hi, I'm trying to detect if a screen reader is attached to my application so that I can improve the experience for blind and low vision users. I'm using this win32 api (http://msdn.microsoft.com/en-us/library/ms724947%28VS.85%29.aspx), and specifying SPI_GETSCREENREADER as the uiAction. Call looks something like this: int iAction = 70...

how to restart a mouse hook?

I have a mouse hook that (for an unknown reason) dies every now and then (not too often). Maybe it's because a mouse move is not processed fast enough by the hook at some point in time or smth. (can someone btw. tell me what the registry key is for the timeout value on Windows 7?), but whatever the reason, I'd like to know how I can rest...

How to get the Directory name/path from an opened handle.

On opening a directory via zwopenfile(open directory option), it returns a handle for the directory path. Now I need to get the directory path from the handle. Its my requirement. I could see an example(please see the code below) where file name can be fetched from file handle. But the below example does not help for directory. Is ther...

How do I resolve process hanging on CoUnitialize()?

I have a native Visual C++ NT service. When the service is started its thread calls CoInitialize() which attaches the thread to an STA - the service thread uses MSXML through COM interfaces. When the service receives SERVICE_CONTROL_STOP it posts a message in the message queue, then later that message is retrieved and the OnStop() handl...

How to resize a window using WM_* messages

Hi everybody! When a window handle is given, how can i exactly resize a window sending windows messages towards it? I've tried many things such as sendig a WM_SIZING Message to the window, but nothing worked(the way i did it). I don't like to use SetWindowPosition. Thanks in advance, David ...

requestedExecutionLevel in manifest file and failing CopyFile() function

Just trying to copy a file using CopyFile() function from the current directory to C:\windows\system32\drivers. I wrote also manifest with "requestedExecutionLevel level="highestAvailable"" in it and I run mt to add it to resulting executable. When I try to run it, Windows 7 UAC dialog popping out, I press "Yes", but CopyFile() returni...

Why does this dialog box close immediately after opening?

My issue is that I am trying to create a Opengl/Win32 application and I am unable to keep my dialog box open. It literally flashes as if someone pressed cancel on it RIGHT when it opened. I've looked around google and found a few others with this issue, but none of the solutions they posted have helped me, so I turn to the StackOverflow ...

Volume to physical drive

Hello, QueryDosDevice(L"E:", DeviceName, MAX_PATH); (E: is a SD card) DeviceName is "\Device\HarddiskVolume3" How do I "convert" it to something like "\\.\PHYSICALDRIVE1" ...

CreateProcess (binary injection) cannot reference DLL's

In following this example code for binary injection: http://www.security.org.sg/code/loadexe.html I can get it to work, inject a second exe into the primary exe's memory space and run. The trouble is that the second exe can not access any DLL's in the startup folder. For example: c:\1.exe c:\2.exe c:\helper.dll If 2.exe is injected...

SD serial number

I am using the following code: int main() { DWORD dwBytesReturned = 0; BOOL bResult = DeviceIoControl(hVol, IOCTL_SFFDISK_DEVICE_COMMAND, pCmdBuf, nSizeOfCmd, pCmdBuf, nSizeOfCmd, &dwBytesReturned, NULL); But pCmdBuf->Data is always empty. I run the program with administrative privileges on a win7 x64. ...

Network Not Available Error when trying to map network drive

I'm calling WNetAddConnection2 during the login process for a 2008R2 box. The action happens right after userinit is run. I'm receiving a 1222 error or Network Not Available. Right after doing this I'm also connecting a couple printers using the AddPrinterConnection function. Both the printers and the network drives are on the same remot...

SendMessage(focused, WM_GETTEXT, builder.Capacity, builder); returns empty string

Hey, I am using the code described in - http://efreedom.com/Question/1-479548/Get-Active-Window-Text-Send-Text, and it has problems retrieving the text from facebook chat or from messenger chat or from textboxes inside websites - it returns an empty string. Do you have any idea what's the problem and how can I overcome it? Thanks, N...