atl: Compare file handle to INVALID_HANDLE_VALUE to handle errors.

This commit is contained in:
Jacek Caban 2007-03-07 00:05:15 +01:00 committed by Alexandre Julliard
parent 26344ce3f2
commit ecac3c1c06
1 changed files with 1 additions and 1 deletions

View File

@ -479,7 +479,7 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
HRESULT hres; HRESULT hres;
file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL); file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
if(file) { if(file != INVALID_HANDLE_VALUE) {
filelen = GetFileSize(file, NULL); filelen = GetFileSize(file, NULL);
regstra = HeapAlloc(GetProcessHeap(), 0, filelen); regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
lres = ReadFile(file, regstra, filelen, NULL, NULL); lres = ReadFile(file, regstra, filelen, NULL, NULL);