Not able to delete key with RegDBDeletekey using InstallShield - installshield

I am new to this InstallShield code.
I am trying to delete a key with
RegDBDeleteKey("Nrs_Log");
But was not able to delete and setup is running fine.
Could anyone suggest any other way to delete a registry key.

There are many reasons why a RegDBDeleteKey() might fail. There is not enough info in your post to determine the problem, so I can't even speculate without more information. So here is how to get more information - You need to get the return value of the RegDBDeleteKey() call, so you can find out what is going on.
The below code gets the return value, converts it to a text error, and displays the result.
result = RegDBDeleteKey("Nrs_Log");
if(result < 0) then
SprintfBox(WARNING, "RegDBDelete...", "Failed to delete registry key.\n Error number: %d \n %s", result, FormatMessage(result) );
endif;
Once you know the actual error, you should be able to fix the problem or Google it for more info.

Please refer to below InstallShield InstallScript on how you can delete a given registry hive. If checks whether the registry key exists or not before trying to delete it:
function DeleteRegistryKeys(hMSI)
STRING keyToDelete;
begin
keyToDelete = "\\SOFTWARE\\MyRegistryHive\\";
//comment below line if your target root hive is HKEY_CLASSES_ROOT
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); //Set this if you want to change the registry root to HKEY_LOCAL_MACHINE.
REGDB_OPTIONS = REGDB_OPTION_WOW64_64KEY; //Set this only if you want to search WOW64 hive of HKEY_LOCAL_MACHINE if you've a 32-bit installer running on a 64 bit operating system.
if (RegDBKeyExist (keyToDelete) > 0) then
SprintfMsiLog ("registry keys found. Going to delete registry keys");
if (RegDBDeleteKey (keyToDelete) < 0) then
SprintfMsiLog ("Failed to delete registry keys.");
else
SprintfMsiLog ("Registry keys deleted successfully.");
endif;
else
SprintfMsiLog ("Registry keys not found.");
endif;
end;

Related

This row was already applied and cannot be modified

When i run my code in the test environment to test my new code about kudu insert,it reports to me:
This row was already applied and cannot be modified.
I have already tried to debug my code and to see what is the problem in my code , but it is useless
if((map.get(list.get(i))) instanceof Double){
row.addDouble(list.get(i), (Double) map.get(list.get(i)));
//System.out.println("Double type insert succeed : " + list.get(i) + " : " + map.get(list.get(i)));
continue;
}
I want to know what's wrong in my code because in my previous code i can run correct but know it cannot
In the source code ,The class was that PartialRow has a private propertiy:frozen, It's default value was false,but in my code,when i debug in it,i found that value was true,I think this is the reason that cause the program reports to my : This row was alredy applied and cannot be modified ! asking for help .please
Without full stacktrace and the rest of code I can only guess why this is happening.
My guess is because the Insert object on which this row object is created has already inserted to Kudu (using KuduSession.apply) and then you tried to update it using row.addDouble.
If you are unsure about why please see this example of how to insert into Kudu.
KuduSession.apply method is invoked on Insert object on which PartialRow object is created, this will insert the data from all the PartialRow objects created from the Insert object. This can be done only once on one Insert object. After that you create a new Insert object using KuduTable.newInsert()
In your case you should probably create new object of Insert using KuduTable.newInsert() and create a row object on this.

#DbLookup formula in dialog list: Server error: Entry not found in index

As usual, I am trying to populate my Dialog List field by using #-formula in it:
server:="WPRServer/Un";
dbPath:="Region/Users.nsf";
viewName:="Search_users";
#DbLookup("":"NoCache"; server:dbPath; viewName; "myKey"; 2)
But every time I am getting the error in my field:
Server error: Entry not found in index
I have tryed to use this formula to this field with another database on other server with different key names, but I am getting this error on this field again.
I have updated the views with CTRL + SHIFT + F9.
Tryed to update the current db design.
Recompiled LS and all views.
This is very strange, because I am using the similar formulas in other databases and everything is working fine every time.
Can you please give some small advise what is the way to fix this issue or maybe I am doing something incorrect? Thank you.
Update 17.09.2018:
1. The view Search_users is sorted.
2. I am using Windows server, and tryed to add **\** slashes and It helped to solve this issue, now I am getting this error:
This database is currently in use by another person or process, and cannot be accessed at this time. In order to share a Notes database, it must be accessed via a Domino Server by all users of the database.
I have tryed to reset all current accesses to this database with Domino Administrator tool, nothing helped - still getting this error in my Dialog List.
3. #DbColumn formula works fine with this view.
4. Also, already tryed to compact the database, no changes.
This may show you what the issue is:
server:="WPRServer/Un";
dbPath:="Region/Users.nsf";
viewName:="Search_users";
searchkey := "myKey";
rslt := #DbLookup("":"NoCache"; server:dbPath; viewName; searchkey; 2);
#If(#IsError(rslt); #Text(rslt) + " for:[" + searchkey + "]"; rslt);
Anticipation and handling error conditions.

XPages SSJS - Creating a Document in Another Database

I get the error "Exception occurred calling method NotesDatabase.createDocument() null" for the following:
var db:NotesDatabase = session.getDatabase("", viewScope.targetDb);
if (db != null) {
if(db.isOpen()){
}else{
db.open();
}
} else {
}
var doc:NotesDocument = db.createDocument();
Comments:
The database db is available and "open".
The user has enough rights in the targetDb to create documents.
What is wrong?
I changed db.isOpen to db.isOpen(), according to Paul Stephen Withers tips.
And now db.open() gives the error "Exception occurred calling method NotesDatabase.open() null" although that I can get, in viewScope variables, the server, FilePath, etc.
Change
var db:NotesDatabase = session.getDatabase("", viewScope.targetDb);
to
var db:NotesDatabase = session.getDatabase(currentDatabase.getServer(), viewScope.targetDb);
This works on the web as well as XPinC.
XPages isn't the same as formula, it doesn't like the empty string definition for the server name, which is contrary to the documentation which states (for the server parameter of NotesSession.getDatabase - javascript):]
The name of the server on which the database resides. Use null to
indicate the session's environment, for example, the current computer
Using null or "" gives error 500, it would appear.
The code from the question will work, if :
the if block is removed entirely
the viewScope.targetDb variable has a properly specified notes database file path, which exists on the same server as the current database
the current user has access to the target database ( by the ACL ), with the Create Database right
the target database has a Maximum Internet name and password above Reader as per #Paul
I suspect the cause is you're checking db.isOpen. You should check db.isOpen().
Worth bearing in mind is session.getDatabase(String, String) doesn't return null (unless you're using OpenNTF Domino API). It returns a Database object that is not open. So that if statement is irrelevant. Also best practice is to pass a server name to session.getDatabase() - you'll get a different outcome if the application is ever used in XPiNC with your current code.
Regardless of individuals' user access, "Maximum Internet name and password" on the Advanced tab of the ACL will override that. If maximum internet access is No Access, no one will be able to create documents. But I suspect that's not a factor here.
Pro Tip -- Get the Debug Toolbar and use that to print out messages to the XPage debug toolbar to see what is going on and if your viewScope variable is being set. Also, learn to use the try catch block to catch your exceptions and print out the error message to the debug toolbar. You will find your issue that way.
https://www.openntf.org/main.nsf/project.xsp?r=project/XPage%20Debug%20Toolbar

What to do when get "The model used to open the store is incompatible with the one used to create the store"?

I had a core data EntityDescription and I created data in it. Then, I changed the EntityDescription, added new one, deleted the old one using the editor for xcdatamodeld file.
Now any of my code for core data causes this error "The model used to open the store is incompatible with the one used to create the store}". The detail is below. What should I do? I prefer to remove everything in the data model and restart new one.
Thanks for any suggestion!
reason=The model used to open the store is incompatible with the one used to create the store}, {
metadata = {
NSPersistenceFrameworkVersion = 320;
NSStoreModelVersionHashes = {
Promotion = <472663da d6da8cb6 ed22de03 eca7d7f4 9f692d88 a0f273b7 8db38989 0d34ba35>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
);
NSStoreType = SQLite;
NSStoreUUID = "9D6F4C7E-53E2-476A-9829-5024691CED03";
"_NSAutoVacuumLevel" = 2;
};
Or if you're in dev mode, you can also just delete the app and run it again.
Deleting the app is sometimes not the case! Suggest, your app has already been published! You can't just add new entity to the data base and go ahead - you need to perform migration!
For those who doesn't want to dig into documentation and is searching for a quick fix:
Open your .xcdatamodeld file
click on Editor
select Add model version...
Add a new version of your model (the new group of datamodels added)
select the main file, open file inspector (right-hand panel) and under Versioned core data model select your new version of data model for current data model
THAT'S NOT ALL ) You should perform so called "light migration".
Go to your AppDelegate and find where the persistentStoreCoordinator is being created
Find this line if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])
Replace nil options with #{NSMigratePersistentStoresAutomaticallyOption:#YES, NSInferMappingModelAutomaticallyOption:#YES} (actually provided in the commented code in that method)
Here you go, have fun!
P.S. This only applies for lightweight migration. For your migration to qualify as a lightweight migration, your changes must be confined to this narrow band:
Add or remove a property (attribute or relationship).
Make a nonoptional property optional.
Make an optional attribute nonoptional, as long as you provide a default value.
Add or remove an entity.
Rename a property.
Rename an entity.
Answer borrowed from Stas
If this is a non-production app, just delete your local database (appname.sqlite) and restart the app.
I find I'm always doing this, and so provide the following additional detail:
Under XCode 4 (4.3.2) you should find your datastore here:
/Users/~/Library/Application Support/iPhone Simulator/simulatorVersion/Applications/yourAppIdentifier/Documents
Or you can use Spotlight, if you first enable searching for System Files; I've found it fastest to save such a search to the menu bar.
If this is a non-production app, just delete your local database (appname.sqlite) and restart the app.
Delete your app on simulator and restart:
On simulator, go to Hardware -> Home:
Click and hold mouse button on your application icon:
Click on "X" in app icon to delete:
Go back to Xcode and restart your application(Command+R):
or:
PS.:
If the error appears again, review your code because the problem should be in the syntax or discrepancy between what you want to list with the data model that you have.
Reset your simulator and run again. If you were to run with a different device in the simulator, it would work. If you are running with an iphone 6s simulator and you try to run 6s plus, it would still work without resetting.
If running on a phone, make sure to delete the app and rerun it
I have faced the same issue using Xcode 7 beta 1 and the following action has resolved the issue.
Menu==>> click on Window>Projects>select project on the left hand side and click on delete button which is located on the right side.
If still doesn't work,
=> reset the simulator and run the app

RegDBKeyExists function fails to read in Installshield

We have developed MSI package in Installshiled 2008 Premier Edition and project type is Installscript MSI, recently we bought 2011 and upgrdaded our project to 2011.
In earlier version we used to check the registry entries for Microsoft SQL Express and its path is
**HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL**
Now a new require came to create a package for 64 bit O.S., since O.S. is 64-bit but the registry path for SQL Express in 64 bit is
**HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL**
The registry function RegDBKeyExists is to check SQL registry's presence, but function is returning a negative number as -2147483646 and fails to read.
setting the option REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY will not help because we not reading 64 bit related registry Hive.
Don't worry about it so much; Registry Reflection makes this do the right thing without extra code. When a 32-bit app accesses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL on a 64-bit machine it will be redirected and see HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL (unless it passes the KEY_WOW64_64KEY - equivalent to the REGDB_OPTION_WOW64_64KEY).
If you hardcode the Wow6432Node key into your query, this scenario will tend to see the keys under a path including HKLM\Software\Wow6432Node\Wow6432Node\... and be unable to find the key you meant to find.
As a follow up to Michael's answer and my comment (i.e. question), here's an InstallScript function to toggle registry reflection:
prototype void EnableRegistryReflection( BOOL );
///////////////////////////////////////////////////////////////////////////////
//
// Function: EnableRegistryReflection
//
// Purpose: Toogle the automatic conversion of registry keys from 64 to 32 bit equalivents.
// This is enabled by default.
//
///////////////////////////////////////////////////////////////////////////////
function void EnableRegistryReflection( bEnable )
begin
if( bEnable ) then
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY;
else
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
endif;
end;

Resources