On Monday, March 4, 2013 5:51:38 PM UTC-8, John Doe wrote:
An obscure error is returned by WinApi when invoking the ProtectEncryptData:
"The operation completed successfully."
IIRC this is what you're supposed to see on success. The Win32 API calls through Proc/Call pull the err value from GetLastError/FormatMessage, which if the call worked as expected will result in the "error" message you see ("The operation completed successfully.").
You should be looking at the r1, r2 results from the call to Call and analyzing them based on whatever call it is you're making to determine if there is actually any problem you should worry about since all of these API calls use old-school C-style return overloading to signal errors.
I'm not sure if the non-nil err result in this situation is intentional or a bug, it does feel inconsistent with normal Go error handling.
The same error gets returned, when i call WinApi LocalFree on the byte array pointer.
New version: