Andrey Turkin : wordpad: Do not try to close uninitialized handles.
Alexandre Julliard
julliard at winehq.org
Wed Oct 15 10:08:23 CDT 2008
Module: wine
Branch: master
Commit: 71c01bb974074df58a1afb2e1fa74cb8b193fb77
URL: http://source.winehq.org/git/wine.git/?a=commit;h=71c01bb974074df58a1afb2e1fa74cb8b193fb77
Author: Andrey Turkin <andrey.turkin at gmail.com>
Date: Wed Oct 15 00:24:41 2008 +0400
wordpad: Do not try to close uninitialized handles.
---
programs/wordpad/registry.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/programs/wordpad/registry.c b/programs/wordpad/registry.c
index d050686..c7edc5b 100644
--- a/programs/wordpad/registry.c
+++ b/programs/wordpad/registry.c
@@ -78,7 +78,7 @@ static LRESULT registry_get_handle(HKEY *hKey, LPDWORD action, LPCWSTR subKey)
void registry_set_options(HWND hMainWnd)
{
- HKEY hKey;
+ HKEY hKey = 0;
DWORD action;
if(registry_get_handle(&hKey, &action, key_options) == ERROR_SUCCESS)
@@ -101,7 +101,7 @@ void registry_set_options(HWND hMainWnd)
void registry_read_winrect(RECT* rc)
{
- HKEY hKey;
+ HKEY hKey = 0;
DWORD size = sizeof(RECT);
if(registry_get_handle(&hKey, 0, key_options) != ERROR_SUCCESS ||
@@ -119,7 +119,7 @@ void registry_read_winrect(RECT* rc)
void registry_read_maximized(DWORD *bMaximized)
{
- HKEY hKey;
+ HKEY hKey = 0;
DWORD size = sizeof(DWORD);
if(registry_get_handle(&hKey, 0, key_options) != ERROR_SUCCESS ||
@@ -318,8 +318,8 @@ void registry_set_filelist(LPCWSTR newFile, HWND hMainWnd)
(lstrlenW(pFiles[i])+1)*sizeof(WCHAR));
}
}
+ RegCloseKey(hKey);
}
- RegCloseKey(hKey);
registry_read_filelist(hMainWnd);
}
@@ -335,9 +335,10 @@ void registry_read_options(void)
if(registry_get_handle(&hKey, 0, key_options) != ERROR_SUCCESS)
registry_read_pagemargins(NULL);
else
+ {
registry_read_pagemargins(hKey);
-
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
+ }
}
static void registry_read_formatopts(int index, LPCWSTR key, DWORD barState[], DWORD wordWrap[])
More information about the wine-cvs
mailing list