Any suggestions?
Jason
Again, anyone have suggestions? I still can't figure out what is
going on here.
Jason
http://msdn2.microsoft.com/en-us/library/k6b9a7h8.aspx
Anyways, I figured out the problem. Considering that the
documentation says that the extra strings are WCHAR pointers, I had
thought they were UTF-16. Apparently, tho, they are UTF-8. I hate it
when Microsoft's own documentation seems to be wrong.
The documentation is correct, you need to declare your API as Unicode or
Auto for this.
[DllImport("advapi32", CharSet = CharSet.Unicode)]
static extern int ReadEventLog(
or,
[DllImport("advapi32", CharSet = CharSet.Auto)]
static extern int ReadEventLog(
by default the interop marshaller considers all strings as being ANSI.
Willy.
Ok, that's good to know. I would have expected it to default to
Unicode.
Jason