Fix spacing
authorMichael Schuster <michael@schuster.ms>
Thu, 20 Aug 2020 16:47:23 +0000 (18:47 +0200)
committerMichael Schuster <michael@schuster.ms>
Thu, 20 Aug 2020 16:50:05 +0000 (18:50 +0200)
Signed-off-by: Michael Schuster <michael@schuster.ms>
shell_integration/windows/NCContextMenu/dllmain.cpp

index a8c6b6ed6cc8c94d3fbb64c2a81867b32fbd9114..c7da1c9e164a02b604e7cbf8c89964fa08ef3e52 100644 (file)
@@ -23,25 +23,25 @@ long        g_cDllRef = 0;
 
 BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
 {
-       switch (dwReason)
-       {
-       case DLL_PROCESS_ATTACH:
-               // Hold the instance of this DLL module, we will use it to get the 
-               // path of the DLL to register the component.
-               g_hInst = hModule;
-               DisableThreadLibraryCalls(hModule);
-               break;
-       case DLL_THREAD_ATTACH:
-       case DLL_THREAD_DETACH:
-       case DLL_PROCESS_DETACH:
-               break;
-       }
-       return TRUE;
+    switch (dwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+        // Hold the instance of this DLL module, we will use it to get the 
+        // path of the DLL to register the component.
+        g_hInst = hModule;
+        DisableThreadLibraryCalls(hModule);
+        break;
+    case DLL_THREAD_ATTACH:
+    case DLL_THREAD_DETACH:
+    case DLL_PROCESS_DETACH:
+        break;
+    }
+    return TRUE;
 }
 
 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
 {
-       HRESULT hr;
+    HRESULT hr;
     GUID guid;
 
     hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
@@ -49,29 +49,29 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
         return hr;
     }
 
-       hr = CLASS_E_CLASSNOTAVAILABLE;
+    hr = CLASS_E_CLASSNOTAVAILABLE;
 
-       if (IsEqualCLSID(guid, rclsid)) {
-               hr = E_OUTOFMEMORY;
+    if (IsEqualCLSID(guid, rclsid))    {
+        hr = E_OUTOFMEMORY;
 
-               NCContextMenuFactory *pClassFactory = new NCContextMenuFactory();
-               if (pClassFactory) {
-                       hr = pClassFactory->QueryInterface(riid, ppv);
-                       pClassFactory->Release();
-               }
-       }
+        NCContextMenuFactory *pClassFactory = new NCContextMenuFactory();
+        if (pClassFactory) {
+            hr = pClassFactory->QueryInterface(riid, ppv);
+            pClassFactory->Release();
+        }
+    }
 
-       return hr;
+    return hr;
 }
 
 STDAPI DllCanUnloadNow(void)
 {
-       return g_cDllRef > 0 ? S_FALSE : S_OK;
+    return g_cDllRef > 0 ? S_FALSE : S_OK;
 }
 
 STDAPI DllRegisterServer(void)
 {
-       HRESULT hr;
+    HRESULT hr;
     GUID guid;
 
     hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
@@ -79,27 +79,27 @@ STDAPI DllRegisterServer(void)
         return hr;
     }
 
-       wchar_t szModule[MAX_PATH];
-       if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)     {
-               hr = HRESULT_FROM_WIN32(GetLastError());
-               return hr;
-       }
-
-       // Register the component.
-       hr = NCContextMenuRegHandler::RegisterInprocServer(szModule, guid,
-               CONTEXT_MENU_DESCRIPTION, L"Apartment");
-       if (SUCCEEDED(hr))      {
-               // Register the context menu handler. The context menu handler is 
-               // associated with the .cpp file class.
-               hr = NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(L"AllFileSystemObjects", guid, CONTEXT_MENU_REGKEY_NAME);
-       }
-
-       return hr;
+    wchar_t szModule[MAX_PATH];
+    if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)        {
+        hr = HRESULT_FROM_WIN32(GetLastError());
+        return hr;
+    }
+
+    // Register the component.
+    hr = NCContextMenuRegHandler::RegisterInprocServer(szModule, guid,
+        CONTEXT_MENU_DESCRIPTION, L"Apartment");
+    if (SUCCEEDED(hr)) {
+        // Register the context menu handler. The context menu handler is 
+        // associated with the .cpp file class.
+        hr = NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(L"AllFileSystemObjects", guid, CONTEXT_MENU_REGKEY_NAME);
+    }
+
+    return hr;
 }
 
 STDAPI DllUnregisterServer(void)
 {
-       HRESULT hr = S_OK;
+    HRESULT hr = S_OK;
     GUID guid;
 
     hr = CLSIDFromString(CONTEXT_MENU_GUID, (LPCLSID)&guid);
@@ -107,18 +107,18 @@ STDAPI DllUnregisterServer(void)
         return hr;
     }
 
-       wchar_t szModule[MAX_PATH];
-       if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)     {
-               hr = HRESULT_FROM_WIN32(GetLastError());
-               return hr;
-       }
+    wchar_t szModule[MAX_PATH];
+    if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)        {
+        hr = HRESULT_FROM_WIN32(GetLastError());
+        return hr;
+    }
 
-       // Unregister the component.
-       hr = NCContextMenuRegHandler::UnregisterInprocServer(guid);
-       if (SUCCEEDED(hr))      {
-               // Unregister the context menu handler.
-               hr = NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(L"AllFileSystemObjects", CONTEXT_MENU_REGKEY_NAME);
-       }
+    // Unregister the component.
+    hr = NCContextMenuRegHandler::UnregisterInprocServer(guid);
+    if (SUCCEEDED(hr)) {
+        // Unregister the context menu handler.
+        hr = NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(L"AllFileSystemObjects", CONTEXT_MENU_REGKEY_NAME);
+    }
 
-       return hr;
+    return hr;
 }