Commit 87d82501 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

parent 22cb898c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment