| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 /* |  | 
| 2  * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> |  | 
| 3  * |  | 
| 4  * Redistribution and use in source and binary forms, with or without |  | 
| 5  * modification, are permitted provided that the following conditions |  | 
| 6  * are met: |  | 
| 7  * 1. Redistributions of source code must retain the above copyright |  | 
| 8  *    notice, this list of conditions and the following disclaimer. |  | 
| 9  * 2. Redistributions in binary form must reproduce the above copyright |  | 
| 10  *    notice, this list of conditions and the following disclaimer in the |  | 
| 11  *    documentation and/or other materials provided with the distribution. |  | 
| 12  * |  | 
| 13  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |  | 
| 14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |  | 
| 15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |  | 
| 16  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |  | 
| 17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |  | 
| 18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |  | 
| 19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |  | 
| 20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |  | 
| 21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |  | 
| 22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |  | 
| 23  */ |  | 
| 24 |  | 
| 25 #ifndef WindowsExtras_h |  | 
| 26 #define WindowsExtras_h |  | 
| 27 |  | 
| 28 #include <windows.h> |  | 
| 29 #include <objbase.h> |  | 
| 30 #include <shlwapi.h> |  | 
| 31 |  | 
| 32 namespace WebCore { |  | 
| 33 |  | 
| 34 #ifndef HWND_MESSAGE |  | 
| 35 const HWND HWND_MESSAGE = 0; |  | 
| 36 #endif |  | 
| 37 |  | 
| 38 inline HRESULT getRegistryValue(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, 
    LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData) |  | 
| 39 { |  | 
| 40 #if OS(WINCE) |  | 
| 41     HKEY key; |  | 
| 42     if (::RegOpenKeyExW(hkey, pszSubKey, 0, 0, &key) != ERROR_SUCCESS) |  | 
| 43         return ERROR_INVALID_NAME; |  | 
| 44     HRESULT result = ::RegQueryValueExW(key, pszValue, 0, pdwType, static_cast<L
    PBYTE>(pvData), pcbData); |  | 
| 45     ::RegCloseKey(key); |  | 
| 46     return result; |  | 
| 47 #else |  | 
| 48     return ::SHGetValueW(hkey, pszSubKey, pszValue, pdwType, pvData, pcbData); |  | 
| 49 #endif |  | 
| 50 } |  | 
| 51 |  | 
| 52 inline void* getWindowPointer(HWND hWnd, int index) |  | 
| 53 { |  | 
| 54 #if OS(WINCE) |  | 
| 55     return reinterpret_cast<void*>(::GetWindowLong(hWnd, index)); |  | 
| 56 #else |  | 
| 57     return reinterpret_cast<void*>(::GetWindowLongPtr(hWnd, index)); |  | 
| 58 #endif |  | 
| 59 } |  | 
| 60 |  | 
| 61 inline void* setWindowPointer(HWND hWnd, int index, void* value) |  | 
| 62 { |  | 
| 63 #if OS(WINCE) |  | 
| 64     return reinterpret_cast<void*>(::SetWindowLong(hWnd, index, reinterpret_cast
    <LONG>(value))); |  | 
| 65 #else |  | 
| 66     return reinterpret_cast<void*>(::SetWindowLongPtr(hWnd, index, reinterpret_c
    ast<LONG_PTR>(value))); |  | 
| 67 #endif |  | 
| 68 } |  | 
| 69 |  | 
| 70 } // namespace WebCore |  | 
| 71 |  | 
| 72 #endif // WindowsExtras_h |  | 
| OLD | NEW | 
|---|