Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

problems with creating registry key


1 reply to this topic

comicrage

comicrage
  • Members
  • 4 posts

Posted 16 September 2004 - 21:07

I am having some problems creating a simple registry key. I used RegDBCreateKeyEx and it returns 0. When I look at the registry, the key was not created.

Can anyone tell me what I am missin from my code to make this work?

Thanks,

Rage













if ( !Is(USER_ADMINISTRATOR , "") ) then
MessageBox ("You do not have administrator privileges, Contact an administrator to install this Application.", SEVERE );
abort;
endif;

szSiteCode = "AmbassadorTest";
RegDBSetDefaultRoot( HKEY_CURRENT_USER );
szRegPath = "HKEY_CURRENT_USER\\Software\\ODBC\\ODBC.INI";
szKey = szRegPath^szSiteCode+"DSN";
if (RegDBKeyExist(szKey) < 0) then
szKey = "SOFTWARE\\ODBC\\ODBC.INI"^szSiteCode+"DSN";
nResult = RegDBCreateKeyEx(szKey, "");
RegDBSetKeyValueEx( szKey, "Driver", REGDB_STRING, "C:\\orant\\BIN\\SQORA32.DLL", -1 );
RegDBSetKeyValueEx( szKey, "ServerName", REGDB_STRING, @ENROLL_ID, -1 );
RegDBSetKeyValueEx( szKey, "UserID", REGDB_STRING, @ENROLL_PSWD, -1 );
endif;
szKey = szRegPath^"ODBC Data Sources"^szSiteCode+"GESDB";
if (RegDBKeyExist(szKey) < 0) then
szKey = "SOFTWARE\\ODBC\\ODBC.INI"^szSiteCode+"GESDB";
nResult = RegDBCreateKeyEx(szKey, szClass);
endif;

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 17 September 2004 - 01:22

Drop the "HKEY_CURRENT_USER\\" portion from the path. 'cause you've already specificied that via the RegDBSetDefaultRoot call.

Also, you should know that RegDBSetKeyValueEx will automatically create the key if it doesn't already exist.

Edited by Taco Bell, 17 September 2004 - 01:31.

user posted image