win32-process

DEF file syntax error in visual studio 2012

不打扰是莪最后的温柔 提交于 2019-11-28 07:40:39
问题 I have a vs project which wouldn't compile once I upgraded to visual studio 2012. Its a win32 dll project and it complains about the def file. This is the def file, LIBRARY test.dll VERSION 3.1.4.1 EXPORTS addNumbers @1 and this is the error I get when I compile the project in visual studio 2012 ultimate. Source.def(2): fatal error LNK1118: syntax error in 'VERSION' statement What is confusing me is that, this works perfectly fine with visual studio 2008 & 2010. Any idea what is going wrong

Does WaitForSingleObject give up a thread's time slice?

走远了吗. 提交于 2019-11-28 04:34:33
问题 I'm making a win32 program in C. When you have multiple threads running, and one of the threads is waiting for an event (using WaitForSingleObject() for example), does that thread still get its full CPU time slice? Stated differently, does the operating system know that the thread doesn't need its time slice until one of the events is signalled? 回答1: Yes -- the thread is blocked until whatever it's waiting on becomes signaled. The thread won't be scheduled to run while it's blocked, so other

Win32, ReadFile from pipe block even after child terminated

你说的曾经没有我的故事 提交于 2019-11-28 03:02:51
问题 I have a simple program (in C) that create two child process, wait on an inherited pipe each, and put the output in a file. Everything works well, except that after some write/read cycle on the two pipe, when the child ends, the call to ReadFile block, waiting for data on the pipe. I use the following pattern: ... //create pipe1 CreatePipe(&hReadDup,&hWrite,&saAttr,0); DuplicateHandle(GetCurrentProcess(),hReadDup,GetCurrentProcess(),&hRead,0,FALSE,DUPLICATE_SAME_ACCESS); CloseHandle(hReadDup)

Why is RemoveDirectory function not deleting the top most folder?

佐手、 提交于 2019-11-28 02:00:55
问题 refer: codeguru.com/forum/showthread.php?t=239271 When using the function below to delete folders, all folders, subfolders and files are getting deleted except for the top most folder. Say for the path c:\folder1\folder2 every thing under folder2 is deleted except for folder2 . BOOL DeleteDirectory(const TCHAR* sPath) { HANDLE hFind; // file handle WIN32_FIND_DATA FindFileData; TCHAR DirPath[MAX_PATH]; TCHAR FileName[MAX_PATH]; _tcscpy(DirPath,sPath); _tcscat(DirPath,_T("\\")); _tcscpy

Win32 Named mutex not released when process crashes

ぐ巨炮叔叔 提交于 2019-11-27 21:47:58
问题 I have 2 processes (A, B) sharing the same mutex (using WaitForSingleObject / ReleaseMutex calls). Everything works fine, but when process A crashes, process B is humming along happily. When I restart process A, there's a deadlock. Deeper investigation reveals that process B can successfully call ReleaseMutex() twice after process A crashes. My interpretation: After process A crashes, the mutex is still locked, but ownership of the mutex transfers readily to process B (which is a bug). That's

timespec equivalent for windows

点点圈 提交于 2019-11-27 16:47:06
问题 I am porting my application to windows from unix and I have run into a wall. In my application I need to find time in microseconds (the whole application heavily depends on it due to it being a high precision application). Previously I was using timespec structure, but windows contains no such thing. The command GetTickCount does not suffice because it returns time in milliseconds. I was also thinking of QueryPerformanceFrequency . Would anyone happen to know something that is as identical to