getlasterror

GetLastError() and calling unmanaged code in a static library from C++ .NET

I made a static library in Visual C++ 2008 Express Edition. It compiles to Win32 code in a file called static.lib. The functions in this library call SetLastError() to indicate errors or success. I have already succeeded in including this static.lib in a C++ Win32 DLL, and calling the DLL from C# using p/invoke and DllImport and SetLa...

Best way to pass last error to custom error redirect?

Was wondering what you thought of this solution, if this is right way to pass an error message to a custom page? In web.config: <customErrors mode="On" defaultRedirect="~/Error.aspx"></customErrors> In Global.asax: <script RunAt="server"> void Application_Error(object sender, EventArgs e) { Exception ex = Server.GetLast...

Similar function to GetLastError in objective-C/C?

I'm doing some lovely socket programming in objective-C right now and part of my code is giving me an error (in the setsockopt method call). I was wondering if anyone knows of a similar function to the GetLastError() function in C++ that I could use in objective-C to determine the problem with my code? ...

What does ERROR_FILE_NOT_FOUND mean from SendMessage?

SendMessage returning 0 and GetLastError returning 2 (ERROR_FILE_NOT_FOUND). ERROR_ACCESS_DENIED is documented but not this. Anyone have any idea what this means? ...

Installshield 2009 Premier quickpatch project

I created a quickpatch project in Install Shield 2009 Premier. I referenced the previous setup.exe which deployed all 64 bit components. I wanted to replace one dll namely "process.dll" which was in component "process" in the previous .ism file. Actually in that very component there were two dlls namely "process.dll" & "processeng.dll"...

Problem with GetLastError API on windows 7

Hi, I have one application that interacts with the server. If the server is down then then I will get ERROR_WINHTTP_CANNOT_CONNECT I am using getLastError() API to get this error code, I am handling this error code to display proper error messages to the users. This program works fine in Windows 2003. When i tried with Windows7 i am not...

Combining the value of GetLastError and a custom error message

I have a function that returns a different DWORD value for each case there is an error. So I have the following defines: #define ERR_NO_DB_CONNECTION 0x90000 #define ERR_DB_NOT_OPEN 0x90001 #define ERR_DB_LOCKED 0x90002 #define ERR_DB_CONN_LOST 0x90003 Now, I return those values when an error occurs. I nee...

insufficient buffer when call DocumentProperties, also, global unlock wouldn't unlock...

please see comments inline bool res = false; DWORD dwNeeded = DocumentPropertiesW(NULL, m_currPrinterHandle, (LPWSTR) m_currPrinterName.c_str(), NULL, NULL, 0); if (m_devmode_buf) { GlobalFree(m_devmode_buf); } m_devmode_buf = GlobalAlloc(GPTR, dwNeeded); GetLastError(); // = 0; if (m_devmode_buf) { LPDEVMODEW devmode_buf...

when CreateDirectory returns ERROR_ACCESS_DENIED and "shouldn't"

My Win32 app A1 (actually a collection of processes) is trying to use CreateDirectory to create a directory D1 within parent directory P. The path to P is the value of the TMP environment variable, which makes P a potentially busy but generally permissive place. The vast majority of the time, everything works fine, but, rarely, CreateDir...

What causes CreateDirectory to return ERROR_ACCESS_DENIED?

In another question, we established that yes, CreateDirectory occasionally fails with the undocumented GetLastError value of ERROR_ACCESS_DENIED, and that the right way to handle the situation is probably to try again a few times. It's easy to implement such an algorithm, but it's not so easy to test it when you don't know how to reprodu...

Getting Access Denied While Accessing the Named Pipe from Another System

I have a Named Pipe and It Works Fine While I access it using a Client which runs on My System The Client tries to open the File using following code: LPTSTR lpszPipename = TEXT("\\\\smyServerName\\pipe\\iPipe01"); hPipe = CreateFile( lpszPipename, // pipe name GENERIC_READ | // read and write access ...