]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/registry.cpp
Remove some out of date comments.
[wxWidgets.git] / src / msw / registry.cpp
index 0825e131fc1247967ac2f67e97b95cfb00478800..83d11c2769845d5b465d17285fe780b61e5ff63d 100644 (file)
@@ -68,6 +68,10 @@ typedef BYTE* RegBinary;
     #define HKEY_DYN_DATA ((HKEY)0x80000006)
 #endif
 
     #define HKEY_DYN_DATA ((HKEY)0x80000006)
 #endif
 
+#ifndef KEY_WOW64_64KEY
+    #define KEY_WOW64_64KEY 0x0100
+#endif
+
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -356,36 +360,57 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
                           size_t *pnValues,
                           size_t *pnMaxValueLen) const
 {
                           size_t *pnValues,
                           size_t *pnMaxValueLen) const
 {
-    // old gcc headers incorrectly prototype RegQueryInfoKey()
-#if defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__)
-    #define REG_PARAM   (size_t *)
-#else
-    #define REG_PARAM   (LPDWORD)
-#endif
-
   // it might be unexpected to some that this function doesn't open the key
   wxASSERT_MSG( IsOpened(), wxT("key should be opened in GetKeyInfo") );
 
   // it might be unexpected to some that this function doesn't open the key
   wxASSERT_MSG( IsOpened(), wxT("key should be opened in GetKeyInfo") );
 
+  // We need to use intermediate variables in 64 bit build as the function
+  // parameters must be 32 bit DWORDs and not 64 bit size_t values.
+#ifdef __WIN64__
+  DWORD dwSubKeys = 0,
+        dwMaxKeyLen = 0,
+        dwValues = 0,
+        dwMaxValueLen = 0;
+
+  #define REG_PARAM(name) &dw##name
+#else // Win32
+  // Old gcc headers incorrectly prototype RegQueryInfoKey() as taking
+  // size_t but normally we need a cast, even when sizeof(size_t) is the same
+  // as sizeof(DWORD).
+  #if defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__)
+    #define REG_PARAM(name) pn##name
+  #else
+    #define REG_PARAM(name)   (LPDWORD)(pn##name)
+  #endif
+#endif
+
+
   m_dwLastError = ::RegQueryInfoKey
                   (
                     (HKEY) m_hKey,
   m_dwLastError = ::RegQueryInfoKey
                   (
                     (HKEY) m_hKey,
-                    NULL,           // class name
-                    NULL,           // (ptr to) size of class name buffer
+                    NULL,                   // class name
+                    NULL,                   // (ptr to) size of class name buffer
                     RESERVED,
                     RESERVED,
-                    REG_PARAM
-                    pnSubKeys,      // [out] number of subkeys
-                    REG_PARAM
-                    pnMaxKeyLen,    // [out] max length of a subkey name
-                    NULL,           // longest subkey class name
-                    REG_PARAM
-                    pnValues,       // [out] number of values
-                    REG_PARAM
-                    pnMaxValueLen,  // [out] max length of a value name
-                    NULL,           // longest value data
-                    NULL,           // security descriptor
-                    NULL            // time of last modification
+                    REG_PARAM(SubKeys),     // [out] number of subkeys
+                    REG_PARAM(MaxKeyLen),   // [out] max length of a subkey name
+                    NULL,                   // longest subkey class name
+                    REG_PARAM(Values),      // [out] number of values
+                    REG_PARAM(MaxValueLen), // [out] max length of a value name
+                    NULL,                   // longest value data
+                    NULL,                   // security descriptor
+                    NULL                    // time of last modification
                   );
 
                   );
 
+#ifdef __WIN64__
+  if ( pnSubKeys )
+    *pnSubKeys = dwSubKeys;
+  if ( pnMaxKeyLen )
+    *pnMaxKeyLen = dwMaxKeyLen;
+  if ( pnValues )
+    *pnValues = dwValues;
+  if ( pnMaxValueLen )
+    *pnMaxValueLen = dwMaxValueLen;
+#endif // __WIN64__
+
 #undef REG_PARAM
 
   if ( m_dwLastError != ERROR_SUCCESS ) {
 #undef REG_PARAM
 
   if ( m_dwLastError != ERROR_SUCCESS ) {
@@ -1210,7 +1235,7 @@ bool wxRegKey::Export(const wxString& filename) const
 
     wxFFileOutputStream ostr(filename, wxT("w"));
 
 
     wxFFileOutputStream ostr(filename, wxT("w"));
 
-    return ostr.Ok() && Export(ostr);
+    return ostr.IsOk() && Export(ostr);
 #else
     wxUnusedVar(filename);
     return false;
 #else
     wxUnusedVar(filename);
     return false;