atl100: ReadFile doesn't directly return an error code.

oldstable
Dmitry Timoshkov 2013-10-28 17:28:05 +09:00 committed by Alexandre Julliard
parent 22cb898c9e
commit 87d8250117
1 changed files with 2 additions and 4 deletions

View File

@ -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);