08-20-2009 01:19 PM
I am trying to make my code, that works well in WindowsXP, work on a Vista 64 machine but I am having issues. Trying to do an entry into the Registry using RegWriteString(); function on Vista but I keep getting ToolErr_CantOpenKey = -5065.
the XP version:
response = RegWriteString(REGKEY_HKLM, "Software\\ODBC\\ODBC.INI\\ODBC Data Sources",
DB_Source_Name, "Microsoft Access Driver (*.mdb)");
the Vista version:
response = RegWriteString(REGKEY_HKLM, "Software\\Wow6432Node\\ODBC\\ODBC.INI\\ODBC Data Sources",
DB_Source_Name, "Microsoft Access Driver (*.mdb)");
I am logged in as adminsitrator...
TIA
08-24-2009 04:45 PM
Hi TIA,
Running
char *Message = GetGeneralErrorString(-5065);
returns the string "Could not open Registry Key".
There could be a number of things that could result in this error. First, it may have to do with running the app as an administrator.
In Windows Vista/7, there is an "Administrator" account as well as "Administrator" Priviledges. Any user can have "Administrator" priviledges, but there is only one Administrator account. Running an app with user Administrator will run the app with Administrator priviledges automatically. Other users need to run the application specifically with Administrator priviledges. You can do this by right-clicking the exe and select "Run as Administrator".
Second, it could be because you are trying to write directly to Wow6432Node. Typically, you would simply write to the registry location without Wow6432Node in the path, and Windows will automatically alias it to the correct location if the application is a 32bit app. In this case, it is a CVI exe, so it will be a 32 bit application.
That means trying to write to Software\\ODBC\\ODBC.INI\\ODBC Data Sources will automatically write to Software\\Wow6432Node\\ODBC\\ODBC.INI\\ODBC Data Sources.
09-01-2009 03:13 PM
09-01-2009 03:37 PM