Tag Archives: Windows API

RegCopyTree fails with Access denied error (5) on Windows 7

MSDN documentation for RegCopyTree states that ‘The calling process must have KEY_CREATE_SUB_KEY access to the destination key’, however call fails on some keys with Access denied error (5) on Windows 7 Ultimate 64-bit. Changing desired access rights to KEY_ALL_ACCESS solves … Continue reading

Posted in OS, Programming | Tagged , , , | Leave a comment

CreateProcessAsUser fails on Windows XP with System error 233

Today I fixed one bug that was very hard to reproduce. Many hours were spent to figure out what combination caused it: It happens only on Windows XP (not on Vista, Server 2003, 2008, Win 7); It does not happens … Continue reading

Posted in Computers, OS, Programming | Tagged , , , , | 1 Comment

Microsoft’s PowerShell hangs when output is captured using Windows API

I was debugging a program that uses Windows API (Creating a Child Process with Redirected Input and Output) to capture stdout of Microsoft’s Windows PowerShell. Script passed to PowerShell (-File switch) didn’t execute and PowerShell just hanged until killed by … Continue reading

Posted in Computers, OS, Programming | Tagged , , | Leave a comment

Windows API PlaySound error / silence

Today stumbled at strange behavior of Windows API function PlaySound in combination with SND_FILENAME flag. There are two scenarios: No sound is played, and PlaySound returns success (TRUE) in combination with SND_ASYNC; No sound is played, and PlaySound returns failure … Continue reading

Posted in Computers, OS | Tagged , , | Leave a comment

Windows API Function SetFileAttributes silently ignores compressed and encrypted attributes

When you call Windows API function SetFileAttributes, it ignores FILE_ATTRIBUTE_COMPRESSED (0×800) and FILE_ATTRIBUTE_ENCRYPTED (0×4000) values passed as parameters. Most likely it is implemented in this way, because you can pass value from GetFileAttributes, FindFirstFile and FindNextFile without modifications to SetFileAttributes. … Continue reading

Posted in Programming | Tagged | Leave a comment