diff --git a/xpcom/base/nsWindowsHelpers.h b/xpcom/base/nsWindowsHelpers.h index 331a58477b9..4a75ea9e5e7 100644 --- a/xpcom/base/nsWindowsHelpers.h +++ b/xpcom/base/nsWindowsHelpers.h @@ -14,13 +14,13 @@ class nsAutoRefTraits { public: typedef HKEY RawRef; - static HKEY Void() - { - return NULL; + static HKEY Void() + { + return NULL; } - static void Release(RawRef aFD) - { + static void Release(RawRef aFD) + { if (aFD != Void()) { RegCloseKey(aFD); } @@ -32,13 +32,13 @@ class nsAutoRefTraits { public: typedef SC_HANDLE RawRef; - static SC_HANDLE Void() - { - return NULL; + static SC_HANDLE Void() + { + return NULL; } - static void Release(RawRef aFD) - { + static void Release(RawRef aFD) + { if (aFD != Void()) { CloseServiceHandle(aFD); } @@ -51,26 +51,26 @@ class nsSimpleRef protected: typedef HANDLE RawRef; - nsSimpleRef() : mRawRef(NULL) + nsSimpleRef() : mRawRef(NULL) { } - nsSimpleRef(RawRef aRawRef) : mRawRef(aRawRef) + nsSimpleRef(RawRef aRawRef) : mRawRef(aRawRef) { } - bool HaveResource() const + bool HaveResource() const { return mRawRef != NULL && mRawRef != INVALID_HANDLE_VALUE; } public: - RawRef get() const + RawRef get() const { return mRawRef; } - static void Release(RawRef aRawRef) + static void Release(RawRef aRawRef) { if (aRawRef != NULL && aRawRef != INVALID_HANDLE_VALUE) { CloseHandle(aRawRef); @@ -79,29 +79,9 @@ public: RawRef mRawRef; }; - -template<> -class nsAutoRefTraits -{ -public: - typedef HMODULE RawRef; - static RawRef Void() - { - return NULL; - } - - static void Release(RawRef aFD) - { - if (aFD != Void()) { - FreeLibrary(aFD); - } - } -}; - typedef nsAutoRef nsAutoRegKey; typedef nsAutoRef nsAutoServiceHandle; typedef nsAutoRef nsAutoHandle; -typedef nsAutoRef nsModuleHandle; namespace { @@ -130,7 +110,7 @@ namespace } typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process); - IsImmersiveProcessFunc IsImmersiveProcessPtr = + IsImmersiveProcessFunc IsImmersiveProcessPtr = (IsImmersiveProcessFunc)GetProcAddress(user32DLL, "IsImmersiveProcess"); FreeLibrary(user32DLL); @@ -144,34 +124,6 @@ namespace alreadyChecked = true; return isMetro; } - - HMODULE - LoadLibrarySystem32(LPCWSTR module) - { - WCHAR systemPath[MAX_PATH + 1] = { L'\0' }; - - // If GetSystemPath fails we accept that we'll load the DLLs from the - // normal search path. - GetSystemDirectoryW(systemPath, MAX_PATH + 1); - size_t systemDirLen = wcslen(systemPath); - - // Make the system directory path terminate with a slash - if (systemDirLen && systemPath[systemDirLen - 1] != L'\\') { - systemPath[systemDirLen] = L'\\'; - ++systemDirLen; - // No need to re-NULL terminate - } - - size_t fileLen = wcslen(module); - wcsncpy(systemPath + systemDirLen, module, - MAX_PATH - systemDirLen); - if (systemDirLen + fileLen <= MAX_PATH) { - systemPath[systemDirLen + fileLen] = L'\0'; - } else { - systemPath[MAX_PATH] = L'\0'; - } - return LoadLibraryW(systemPath); - } } #endif