diff --git a/reactos/subsys/system/regedit/framewnd.c b/reactos/subsys/system/regedit/framewnd.c index 9856624a9ff..886c44db7e6 100644 --- a/reactos/subsys/system/regedit/framewnd.c +++ b/reactos/subsys/system/regedit/framewnd.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "main.h" #include "regproc.h" @@ -679,20 +680,26 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) IDsObjectPicker *ObjectPicker; WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1]; HRESULT hRet; - - hRet = InitializeRemoteRegistryPicker(&ObjectPicker); + + hRet = CoInitialize(NULL); if (SUCCEEDED(hRet)) { - hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker, - hWnd, - szComputerName, - sizeof(szComputerName) / sizeof(szComputerName[0])); - if (hRet == S_OK) + hRet = InitializeRemoteRegistryPicker(&ObjectPicker); + if (SUCCEEDED(hRet)) { - /* FIXME - connect to the registry */ + hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker, + hWnd, + szComputerName, + sizeof(szComputerName) / sizeof(szComputerName[0])); + if (hRet == S_OK) + { + /* FIXME - connect to the registry */ + } + + FreeObjectPicker(ObjectPicker); } - FreeObjectPicker(ObjectPicker); + CoUninitialize(); } return TRUE; diff --git a/reactos/subsys/system/regedit/main.c b/reactos/subsys/system/regedit/main.c index 6e9d5bbd995..395cc4fc678 100644 --- a/reactos/subsys/system/regedit/main.c +++ b/reactos/subsys/system/regedit/main.c @@ -30,7 +30,6 @@ #include #include #include -#include #include "main.h" #include "hexedit.h" @@ -190,7 +189,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, { MSG msg; HACCEL hAccel; - HRESULT hComInit; + /* int hCrt; FILE *hf; @@ -223,9 +222,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, return FALSE; } hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT); - - /* initialize the COM library for the remote registry object picker dialog */ - hComInit = CoInitialize(NULL); /* Main message loop */ while (GetMessage(&msg, (HWND)NULL, 0, 0)) { @@ -236,11 +232,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, } } - if (SUCCEEDED(hComInit)) - { - CoUninitialize(); - } - ExitInstance(hInstance); return msg.wParam; }