[Gpg4win-devel] KDE/kdepim/kleopatra/utils

Jaroslaw Staniek js at iidea.pl
Fri Feb 29 12:30:58 CET 2008


SVN commit 780519 by staniek:

UNICODE is the default setting on both msvc 2k3 and 2k5 
(what means RegOpenKeyEx expands to RegOpenKeyExW).

Explicitly switch to ANSI versions of WINAPI functions, e.g. RegOpenKeyEx->RegOpenKeyExA.
We use the approach with ANSI functions in kdesupport/kdewin32 too.

It is safe to use ANSI functions as the args are already char*.

Should be applied upstream, too.


CCMAIL:gpg4win-devel at wald.intevation.org



 M  +10 -10    gnupg-registry.c  


--- trunk/KDE/kdepim/kleopatra/utils/gnupg-registry.c #780518:780519
@@ -64,7 +64,7 @@
 
       for (i=0, handle = NULL; !handle && dllnames[i]; i++)
         {
-          handle = LoadLibrary (dllnames[i]);
+          handle = LoadLibraryA (dllnames[i]);
           if (handle)
             {
               func = (HRESULT (WINAPI *)(HWND,int,HANDLE,DWORD,LPSTR))
@@ -124,30 +124,30 @@
   if ( !(root_key = get_root_key(root) ) )
     return NULL;
 
-  if( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) )
+  if( RegOpenKeyExA( root_key, dir, 0, KEY_READ, &key_handle ) )
     {
       if (root)
 	return NULL; /* no need for a RegClose, so return direct */
       /* It seems to be common practise to fall back to HKLM. */
-      if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
+      if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
 	return NULL; /* still no need for a RegClose, so return direct */
     }
 
   nbytes = 1;
-  if( RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) ) {
+  if( RegQueryValueExA( key_handle, name, 0, NULL, NULL, &nbytes ) ) {
     if (root)
       goto leave;
     /* Try to fallback to HKLM also vor a missing value.  */
     RegCloseKey (key_handle);
-    if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
+    if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
       return NULL; /* Nope.  */
-    if (RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes))
+    if (RegQueryValueExA( key_handle, name, 0, NULL, NULL, &nbytes))
       goto leave;
   }
   result = malloc( (n1=nbytes+1) );
   if( !result )
     goto leave;
-  if( RegQueryValueEx( key_handle, name, 0, &type, result, &n1 ) ) {
+  if( RegQueryValueExA( key_handle, name, 0, &type, result, &n1 ) ) {
     free(result); result = NULL;
     goto leave;
   }
@@ -159,14 +159,14 @@
     tmp = malloc (n1+1);
     if (!tmp)
       goto leave;
-    nbytes = ExpandEnvironmentStrings (result, tmp, n1);
+    nbytes = ExpandEnvironmentStringsA (result, tmp, n1);
     if (nbytes && nbytes > n1) {
       free (tmp);
       n1 = nbytes;
       tmp = malloc (n1 + 1);
       if (!tmp)
 	goto leave;
-      nbytes = ExpandEnvironmentStrings (result, tmp, n1);
+      nbytes = ExpandEnvironmentStringsA (result, tmp, n1);
       if (nbytes && nbytes > n1) {
 	free (tmp); /* oops - truncated, better don't expand at all */
 	goto leave;
@@ -232,7 +232,7 @@
           
           /* Try to create the directory if it does not yet exists.  */
           if (access (dir, F_OK))
-            CreateDirectory (dir, NULL);
+            CreateDirectoryA (dir, NULL);
         }
       else
         dir = "C:\\gnupg";



More information about the Gpg4win-devel mailing list