You should not call GetLastError when using PInvoke, the error returned
(1008) is probably not the 'real' value but an intermediate. Use
Marshal.GetLastWin32Error instead.
Willy.
| I have a console based .net 2.0 C# application that fails on a PInvoke
| call to the HrESEBackupPrepare() function in the Exchange backup API.
[quoted text clipped - 25 lines]
| Google groups contains many questions asking why this api fails but
| almost no responses.
r - 23 Jan 2006 16:36 GMT
I use Marshal.GetLastWin32Error() to get the last win32
error.
I have "SetLastError=true" for the DLLImportAttribute() and use
the following code to get the error string (this is easier than
directly calling FormatMessage() win32 api)
e = Marshal.GetLastWin32Error();
System.ComponentModel.Win32Exception t = new System.ComponentModel.Win32Exception(e);
Console.WriteLine(t.Message); //easier than
//importing and calling FormatMessage() win32 API call
Is there some .NET application setting or windows setting that I
need to do so that the .NET application runs using the the user
I am logged in as (a domain administrator)?
Thank you for your earlier reply.
> You should not call GetLastError when using PInvoke, the error returned
> (1008) is probably not the 'real' value but an intermediate. Use
[quoted text clipped - 31 lines]
> | Google groups contains many questions asking why this api fails but
> | almost no responses.