GetVolumePathName() failed with ERROR 158: ERROR_NOT_LOCKED
GetVo开发者_开发技巧lumePathName() API failed and GetLastError() returned ERROR 158: ERROR_NOT_LOCKED.
What is the reason for this error and how to overcome it?
Can you post some example code how you call that method? Your call should look like following:
_TCHAR Buffer[MAX_PATH + 1] = {0};
if (GetVolumePathName(TEXT("C:\\Windows"), Buffer, MAX_PATH)) {
// Buffer should return C:\
// GetLastError() is undefined here
} else {
// returns GetLatError();
}
However you should keep in mind, that GetLastError() is undefined if GetVolumePathName() call was successful. May be this coould have caused that error code?
精彩评论