atl100: ReadFile doesn't directly return an error code.
This commit is contained in:
parent
22cb898c9e
commit
87d8250117
|
@ -495,15 +495,13 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
|
|||
DWORD filelen, len;
|
||||
LPWSTR regstrw;
|
||||
LPSTR regstra;
|
||||
LRESULT lres;
|
||||
HRESULT hres;
|
||||
|
||||
file = CreateFileW(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if(file != INVALID_HANDLE_VALUE) {
|
||||
filelen = GetFileSize(file, NULL);
|
||||
regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
|
||||
lres = ReadFile(file, regstra, filelen, NULL, NULL);
|
||||
if(lres == ERROR_SUCCESS) {
|
||||
if(ReadFile(file, regstra, filelen, NULL, NULL)) {
|
||||
len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
|
||||
regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, len);
|
||||
|
@ -514,7 +512,7 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
|
|||
HeapFree(GetProcessHeap(), 0, regstrw);
|
||||
}else {
|
||||
WARN("Failed to read faile\n");
|
||||
hres = HRESULT_FROM_WIN32(lres);
|
||||
hres = HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, regstra);
|
||||
CloseHandle(file);
|
||||
|
|
Loading…
Reference in New Issue