windows-wow64-registry-20080208

LICENSE MIT

Enable the 32-bit tools that are distributed for use in the WOW64 environment
to access the 64-bit registry keys instead of the 32-bit versions.  This
will remove the need to support both 64-bit and 32-bit versions of the
values.
This commit is contained in:
Jeffrey Altman 2008-02-09 02:30:17 +00:00
parent 0caf7c54df
commit cd82af9d4e
23 changed files with 140 additions and 52 deletions

View File

@ -412,7 +412,7 @@ $(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res $(EXELIBS)
$(EXEPREP)
# afsshare.exe
$(EXEDIR)\afsshare.exe: $(OUT)\afsshare.obj $(OUT)\afsshare.res
$(EXEDIR)\afsshare.exe: $(OUT)\afsshare.obj $(OUT)\afsshare.res $(EXELIBS)
$(EXECONLINK)
$(_VC_MANIFEST_EMBED_EXE)
$(EXEPREP)

View File

@ -497,6 +497,34 @@ KFW_cleanup(void)
FreeLibrary(hKrb5);
}
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
static int IsWow64()
{
static int init = TRUE;
static int bIsWow64 = FALSE;
if (init) {
HMODULE hModule;
LPFN_ISWOW64PROCESS fnIsWow64Process = NULL;
hModule = GetModuleHandle(TEXT("kernel32"));
if (hModule) {
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(hModule, "IsWow64Process");
if (NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
{
// on error, assume FALSE.
// in other words, do nothing.
}
}
FreeLibrary(hModule);
}
init = FALSE;
}
return bIsWow64;
}
int
KFW_accept_dotted_usernames(void)
@ -506,7 +534,7 @@ KFW_accept_dotted_usernames(void)
DWORD value = 1;
code = RegOpenKeyEx(HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(value);
code = RegQueryValueEx(parmKey, "AcceptDottedPrincipalNames", NULL, NULL,
@ -515,7 +543,7 @@ KFW_accept_dotted_usernames(void)
}
if (code != ERROR_SUCCESS) {
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(value);
code = RegQueryValueEx(parmKey, "AcceptDottedPrincipalNames", NULL, NULL,
@ -535,7 +563,7 @@ KFW_use_krb524(void)
DWORD use524 = 0;
code = RegOpenKeyEx(HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(use524);
code = RegQueryValueEx(parmKey, "Use524", NULL, NULL,
@ -544,7 +572,7 @@ KFW_use_krb524(void)
}
if (code != ERROR_SUCCESS) {
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(use524);
code = RegQueryValueEx(parmKey, "Use524", NULL, NULL,
@ -563,7 +591,7 @@ KFW_is_available(void)
DWORD enableKFW = 1;
code = RegOpenKeyEx(HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(enableKFW);
code = RegQueryValueEx(parmKey, "EnableKFW", NULL, NULL,
@ -573,7 +601,7 @@ KFW_is_available(void)
if (code != ERROR_SUCCESS) {
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
len = sizeof(enableKFW);
code = RegQueryValueEx(parmKey, "EnableKFW", NULL, NULL,

View File

@ -32,7 +32,7 @@ main(int argc, char **argv) {
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_WRITE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ|KEY_WRITE,
NULL,
&hkSubmounts,
NULL) == ERROR_SUCCESS)
@ -50,7 +50,7 @@ main(int argc, char **argv) {
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ,
NULL,
&hkParameters,
NULL) == ERROR_SUCCESS)

View File

@ -89,6 +89,7 @@
#define CM_ERROR_INEXACT_MATCH (CM_ERROR_BASE+54)
#define CM_ERROR_BPLUS_NOMATCH (CM_ERROR_BASE+55)
#define CM_ERROR_EAS_NOT_SUPPORTED (CM_ERROR_BASE+56)
#define CM_ERROR_RANGE_NOT_LOCKED (CM_ERROR_BASE+57)
/* Used by cm_FollowMountPoint and cm_GetVolumeByName */
#define RWVOL 0

View File

@ -702,7 +702,7 @@ static DWORD IsFreelance(void)
DWORD enabled = 0;
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
dummyLen = sizeof(cm_freelanceEnabled);
code = RegQueryValueEx(parmKey, "FreelanceClient", NULL, NULL,
@ -721,7 +721,7 @@ static const char * NetbiosName(void)
DWORD enabled = 0;
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
dummyLen = sizeof(buffer);
code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL,
@ -4036,7 +4036,7 @@ CSCPolicyCmd(struct cmd_syndesc *asp, void *arock)
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE,
NULL,
&hkCSCPolicy,
NULL );
@ -4084,7 +4084,7 @@ CSCPolicyCmd(struct cmd_syndesc *asp, void *arock)
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_QUERY_VALUE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ|KEY_QUERY_VALUE,
NULL,
&hkCSCPolicy,
NULL );

View File

@ -197,7 +197,8 @@ void fs_utils_InitMountRoot()
char *pmount=mountRoot;
DWORD len=sizeof(mountRoot)-1;
printf("int mountroot \n");
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0, KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS)
if ((RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey)!= ERROR_SUCCESS)
|| (RegQueryValueEx(parmKey, "Mountroot", NULL, NULL,(LPBYTE)(mountRoot), &len)!= ERROR_SUCCESS)
|| (len==sizeof(mountRoot)-1)
)
@ -215,4 +216,3 @@ void fs_utils_InitMountRoot()
strcpy(cm_back_slash_mount_root+1,pmount);
cm_back_slash_mount_root[0]='\\';
}

View File

@ -2639,7 +2639,11 @@ void smb_MapNTError(long code, unsigned long *NTStatusp)
}
else if (code == CM_ERROR_BAD_LEVEL) {
NTStatus = 0xC0000148L; /* Invalid Level */
} else {
}
else if (code == CM_ERROR_RANGE_NOT_LOCKED) {
NTStatus = 0xC000007EL; /* Range Not Locked */
}
else {
NTStatus = 0xC0982001L; /* SMB non-specific error */
}

View File

@ -101,7 +101,7 @@ static const char * NetbiosName(void)
DWORD enabled = 0;
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
dummyLen = sizeof(buffer);
code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL,

View File

@ -29,6 +29,35 @@ static long CopyValues(HKEY srcKey, HKEY dupKey);
static long CopySubkeys(const char *srcName, HKEY srcKey,
const char *dupName, HKEY dupKey);
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
int IsWow64(void)
{
static int init = TRUE;
static int bIsWow64 = FALSE;
if (init) {
HMODULE hModule;
LPFN_ISWOW64PROCESS fnIsWow64Process = NULL;
hModule = GetModuleHandle(TEXT("kernel32"));
if (hModule) {
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(hModule, "IsWow64Process");
if (NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
{
// on error, assume FALSE.
// in other words, do nothing.
}
}
FreeLibrary(hModule);
}
init = FALSE;
}
return bIsWow64;
}
/* ----------------------- exported functions ----------------------- */
@ -86,9 +115,9 @@ RegOpenKeyAlt(HKEY key, /* [in] open key from which to start */
if (create) {
status = RegCreateKeyEx(key, subKeyName,
(DWORD)0, "AFS", REG_OPTION_NON_VOLATILE,
mode, NULL, resultKeyP, &keyDisp);
(IsWow64()?KEY_WOW64_64KEY:0)|mode, NULL, resultKeyP, &keyDisp);
} else {
status = RegOpenKeyEx(key, subKeyName, (DWORD)0, mode, resultKeyP);
status = RegOpenKeyEx(key, subKeyName, (DWORD)0, (IsWow64()?KEY_WOW64_64KEY:0)|mode, resultKeyP);
}
if (resultKeyDispP) {
@ -240,7 +269,7 @@ RegDeleteKeyAlt(HKEY key,
/* determine if delete failed due to subkeys */
HKEY subKey;
status = RegOpenKeyEx(key, subKeyName, 0, KEY_ALL_ACCESS, &subKey);
status = RegOpenKeyEx(key, subKeyName, 0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_ALL_ACCESS, &subKey);
if (status == ERROR_SUCCESS) {
char *keyEnum;

View File

@ -234,6 +234,9 @@ extern long
RegDupKeyAlt(const char *sourceKey,
const char *targetKey);
extern int
IsWow64(void);
#ifdef __cplusplus
};
#endif

View File

@ -66,6 +66,7 @@ EXELIBS = \
$(DESTDIR)\lib\afsdes.lib \
$(DESTDIR)\lib\afsauthent.lib \
$(DESTDIR)\lib\libafsconf.lib \
$(DESTDIR)\lib\afs\afsreg.lib \
$(DESTDIR)\lib\afskfw.lib
############################################################################

View File

@ -298,7 +298,8 @@ void Advanced_OnStartup (HWND hDlg)
g.fStartup = IsDlgButtonChecked (hDlg, IDC_STARTUP);
HKEY hk;
if (RegCreateKey (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), &hk) == 0)
if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), 0, NULL, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;

View File

@ -158,7 +158,8 @@ void GetGatewayName (LPTSTR pszGateway)
{
*pszGateway = TEXT('\0');
HKEY hk;
if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), &hk) == 0)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = MAX_PATH;
DWORD dwType = REG_SZ;
@ -240,7 +241,8 @@ BOOL IsServiceConfigured (void)
{
rc = TRUE;
}
else if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), &hk) == 0)
else if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT(AFSREG_CLT_SVC_PARAM_SUBKEY), 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
TCHAR szCell[ MAX_PATH ];
DWORD dwSize = sizeof(szCell);
@ -454,7 +456,8 @@ int GetDefaultCell (LPTSTR pszCell)
int rc;
HKEY hk;
if (RegOpenKey (HKEY_CURRENT_USER, TEXT(AFSREG_USER_OPENAFS_SUBKEY), &hk) == 0)
if (RegOpenKeyEx (HKEY_CURRENT_USER, TEXT(AFSREG_USER_OPENAFS_SUBKEY), 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(szCellA);
DWORD dwType = REG_SZ;

View File

@ -181,7 +181,8 @@ BOOL InitApp (LPSTR pszCmdLineA)
if (fInstall)
{
HKEY hk;
if (RegCreateKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, &hk) == 0)
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0, NULL, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;
@ -216,14 +217,16 @@ BOOL InitApp (LPSTR pszCmdLineA)
return FALSE;
HKEY hk;
if (RegOpenKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, &hk) == 0)
if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;
RegQueryValueEx (hk, TEXT("ShowTrayIcon"), NULL, &dwType, (PBYTE)&g.fStartup, &dwSize);
RegCloseKey (hk);
}
else if (RegOpenKey (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, &hk) == 0)
else if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;
@ -402,7 +405,8 @@ BOOL IsServerInstalled (void)
BOOL fInstalled = FALSE;
HKEY hk;
if (RegOpenKey (HKEY_LOCAL_MACHINE, AFSREG_SVR_SVC_SUBKEY, &hk) == 0)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_SVR_SVC_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
fInstalled = TRUE;
RegCloseKey (hk);

View File

@ -60,7 +60,8 @@ void LoadRemind (size_t iCreds)
g.aCreds[ iCreds ].fRemind = TRUE;
HKEY hk;
if (RegOpenKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", &hk) == 0)
if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwValue = 1;
DWORD dwSize = sizeof(dwValue);
@ -75,7 +76,8 @@ void LoadRemind (size_t iCreds)
void SaveRemind (size_t iCreds)
{
HKEY hk;
if (RegCreateKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", &hk) == 0)
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY "\\Reminders", 0, NULL, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
{
DWORD dwValue = g.aCreds[ iCreds ].fRemind;
RegSetValueEx (hk, g.aCreds[ iCreds ].szCell, NULL, REG_DWORD, (PBYTE)&dwValue, sizeof(DWORD));
@ -131,4 +133,3 @@ HWND GetTabChild (HWND hTab)
return NULL;
}

View File

@ -18,6 +18,7 @@ extern "C" {
#include <windows.h>
#include <winerror.h>
#include <WINNT/TaLocale.h>
#include "afscreds.h"
#include "settings.h"
@ -91,7 +92,8 @@ BOOL StoreSettings (HKEY hkParent,
void EraseSettings (HKEY hkParent, LPCTSTR pszBase, LPCTSTR pszValue)
{
HKEY hk;
if (RegOpenKey (hkParent, pszBase, &hk) == 0)
if (RegOpenKeyEx (hkParent, pszBase, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_SET_VALUE, &hk) == 0)
{
RegDeleteValue (hk, pszValue);
RegCloseKey (hk);
@ -108,7 +110,8 @@ BOOL GetBinaryRegValue (HKEY hk,
BOOL rc = FALSE;
HKEY hkFinal;
if (RegOpenKey (hk, pszBase, &hkFinal) == ERROR_SUCCESS)
if (RegOpenKeyEx (hk, pszBase, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hkFinal) == ERROR_SUCCESS)
{
DWORD dwType;
DWORD dwSize = (DWORD)cbData;
@ -130,7 +133,8 @@ size_t GetRegValueSize (HKEY hk,
size_t cb = 0;
HKEY hkFinal;
if (RegOpenKey (hk, pszBase, &hkFinal) == ERROR_SUCCESS)
if (RegOpenKeyEx (hk, pszBase, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hkFinal) == ERROR_SUCCESS)
{
DWORD dwType;
DWORD dwSize = 0;
@ -156,7 +160,8 @@ BOOL SetBinaryRegValue (HKEY hk,
BOOL rc = FALSE;
HKEY hkFinal;
if (RegCreateKey (hk, pszBase, &hkFinal) == ERROR_SUCCESS)
if (RegCreateKeyEx (hk, pszBase, 0, NULL, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hkFinal, NULL) == ERROR_SUCCESS)
{
DWORD dwSize = (DWORD)cbData;
@ -176,7 +181,8 @@ BOOL SetBinaryRegValue (HKEY hk,
BOOL RegDeltreeKey (HKEY hk, LPTSTR pszKey)
{
HKEY hkSub;
if (RegOpenKey (hk, pszKey, &hkSub) == 0)
if (RegOpenKeyEx (hk, pszKey, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, &hkSub) == 0)
{
TCHAR szFound[ MAX_PATH ];
while (RegEnumKey (hkSub, 0, szFound, MAX_PATH) == 0)

View File

@ -117,7 +117,7 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
TCHAR szParams[ 64 ] = TEXT(AFSCREDS_SHORTCUT_OPTIONS);
code = RegOpenKeyEx(HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &hk);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk);
if (code == ERROR_SUCCESS) {
len = sizeof(szParams);
type = REG_SZ;
@ -127,7 +127,7 @@ void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
}
if (code != ERROR_SUCCESS) {
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,
0, KEY_QUERY_VALUE, &hk);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk);
if (code == ERROR_SUCCESS) {
len = sizeof(szParams);
type = REG_SZ;

View File

@ -263,7 +263,8 @@ void Main_OnInitDialog (HWND hDlg)
GetString (szUser, IDS_UNKNOWN);
HKEY hk;
if (RegOpenKey (HKEY_LOCAL_MACHINE, AFSREG_CLT_SW_VERSION_SUBKEY, &hk) == 0)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_CLT_SW_VERSION_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(szVersion);
DWORD dwType = REG_SZ;
@ -463,14 +464,16 @@ void Main_OnCheckTerminate (void)
{
HKEY hk;
if (RegOpenKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, &hk) == 0)
if (RegOpenKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;
RegQueryValueEx (hk, TEXT("ShowTrayIcon"), NULL, &dwType, (PBYTE)&g.fStartup, &dwSize);
RegCloseKey (hk);
}
else if (RegOpenKey (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, &hk) == 0)
else if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &hk) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;
@ -803,7 +806,8 @@ void Terminate_OnOK (HWND hDlg)
g.fStartup = IsDlgButtonChecked (hDlg, IDC_STARTUP);
HKEY hk;
if (RegCreateKey (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, &hk) == 0)
if (RegCreateKeyEx (HKEY_CURRENT_USER, AFSREG_USER_OPENAFS_SUBKEY, 0, NULL, 0,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE, NULL, &hk, NULL) == 0)
{
DWORD dwSize = sizeof(g.fStartup);
DWORD dwType = REG_DWORD;

View File

@ -60,6 +60,7 @@ DLLLIBS =\
$(DESTDIR)\lib\afsauthent.lib \
$(DESTDIR)\lib\libafsconf.lib \
$(DESTDIR)\lib\libosi.lib \
$(DESTDIR)\lib\afs\afsreg.lib \
$(DESTDIR)\lib\afs\TaLocale.lib \
$(DESTDIR)\lib\afs\afsutil.lib

View File

@ -20,8 +20,10 @@ extern "C" {
#include <winsock2.h>
#include "help.h"
#include "shell_ext.h"
#include "winreg.h"
#include <winreg.h>
extern "C" {
#include "WINNT\afsreg.h"
}
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
@ -303,7 +305,7 @@ LRESULT DoValueDelete(HKEY hKey,PTCHAR pszSubKey,PTCHAR szValue=NULL)
lResult = RegOpenKeyEx( hKey,
pszSubKey,
0,
KEY_ALL_ACCESS,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_ALL_ACCESS,
&thKey);
if(NOERROR == lResult)
{
@ -347,3 +349,4 @@ STDAPI DllUnregisterServer(void)
return S_OK;
}

View File

@ -1057,7 +1057,7 @@ const char * NetbiosName(void)
DWORD enabled = 0;
code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
0, KEY_QUERY_VALUE, &parmKey);
0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &parmKey);
if (code == ERROR_SUCCESS) {
dummyLen = sizeof(buffer);
code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL,
@ -2181,4 +2181,3 @@ BOOL ListSymlink(CStringArray& files)
return !error;
}

View File

@ -79,7 +79,7 @@ CShellExt::CShellExt()
m_bIsOverlayEnabled=FALSE;
if (FAILED(hr))
m_pAlloc = NULL;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,0, KEY_QUERY_VALUE, &NPKey);
RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,0, (IsWow64()?KEY_WOW64_64KEY:0)|KEY_QUERY_VALUE, &NPKey);
LSPsize=sizeof(ShellOption);
code=RegQueryValueEx(NPKey, "ShellOption", NULL,
&LSPtype, (LPBYTE)&ShellOption, &LSPsize);

View File

@ -53,7 +53,7 @@ static CSubmountInfo *ReadSubmtInfo(const CString& strShareName)
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ,
NULL,
&hkSubmounts,
NULL );
@ -174,7 +174,7 @@ BOOL CSubmountsDlg::FillSubmtList()
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
NULL,
&hkSubmounts,
NULL );
@ -256,7 +256,7 @@ static BOOL AddSubmt(CSubmountInfo *pInfo)
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE,
NULL,
&hkSubmounts,
NULL );
@ -278,7 +278,7 @@ static BOOL DeleteSubmt(CSubmountInfo *pInfo)
0,
"AFS",
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
(IsWow64()?KEY_WOW64_64KEY:0)|KEY_WRITE,
NULL,
&hkSubmounts,
NULL );