I have an installscriptmsi project, whose output is setup.exe. I am able to install it on Vista and higher without any issues. I am not prompted for UAC. But on XP, I am prompted with Run As dialog always. I know it is because of setting LAAW_SHELLEXECUTEVERB = "runas" that I am getting the Run as prompt. But I do want my installer to run as admin on XP. I have also set RequiredExecutionLevel as Administrator under Release.
So is there a way I can get the installscriptmsi not to prompt for UAC on XP. I am using IS2012. I am pasting the script below.
function OnBegin()
STRING szProgram, szCmdLine, szDirectory;
NUMBER nShowWindow, nTimeOut, nOptions;
STRING szTestVersionKey;
begin
szProgram = "MsiExec.exe";
szDirectory = "";
nShowWindow = SW_NORMAL;
nTimeOut = 1000 * 60 * 10;
nOptions = LAAW_OPTION_USE_SHELLEXECUTE;
LAAW_SHELLEXECUTEVERB = "runas";
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
// uninstall another 3rd party software if on the system.
szSofTestVersionKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15F6E1D5-12FF-4BBD-B02F-6440C7A2763C}";
if ( RegDBKeyExist(szTestVersionKey) ) then
szCmdLine = "/uninstall {15F6B1B5-12FF-4DBD-A02F-6640C7A2863C} /norestart /quiet";
LaunchApplication( szProgram, szCmdLine, szDirectory, nShowWindow, nTimeOut, nOptions );
endif;
end;
You're writing script already, so I would just condition whether you set LAAW_SHELLEXECUTEVERB to runas, or leave it as open. You might compare SYSINFO.nOSMajor to 6, or examine SYSINFO.WINNT.bWinXP to determine which OS you're on, and select the verb accordingly.
Related
Ive been trying to detect the excel process in my installshield installer.
I have a custom action that runs after appsearch and pops a window if it finds the process and displays a warning to the user.
I have tried using some old examples I found on installsite.org and using the findWindow() call. Neither seems to find excel.exe in the process list.
Here is a snippet of code I was using when trying the findwindow
export prototype MyTestFunction(HWND);
function MyTestFunction(hMSI)
HWND nHwnd;
begin
nHwnd = FindWindow("EXCEL", "");
if (nHwnd != 0) then
MessageBox("found excel", WARNING);
SendMessage(nHwnd, WM_CLOSE, 0, 0);
else
MessageBox("cant find excel", WARNING);
endif;
end;
Note that only the else block ever seems to fire regardless of the application being open or closed.
I have tried several different variants of this mostly just replacing the "excel" with different capitalization, extensions and versions. Nothing seems to detect the window. I used Spy++ and it reported that the window is named after the name of the currently opened notebook which complicates things since I have no way of knowing what a user could have opened.
I am open to suggestions here. The only requirement for this solution is that it has to be able to run as either a custom action or part of an install condition from within Installshield.
You could use a vbscript Custom Action.
You can run this CA at the begining of UISequence or ExecuteSequence (or both) If you want it as a part of the Install condition.
Add the code in a vbscript function and configure "Return Processing" Option for the Custom Action to "Synchonous (Check exit code)" if you want to stop the installation process.
Here is my script:
Public Function StopProcess
Dim objWMIService, objProcess, colProcess
Dim strComputer, executableFileName
Const IDABORT = 3
strComputer = "."
executableFileName = "excel.exe"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name = '" & executableFileName & "'")
For Each objProcess in colProcess
objProcess.Terminate()
' OR
StopProcess = IDABORT
Exit for
Next
End function
Obviously trying to figure out if a process is running by finding the associated window has its pitfalls.
My suggestion is to detect if the process for Excel.exe is running. It would involve enumerating the processes on the system. Modify your code accordingly. Its easier to do it using C++ but there are numerous examples available which show you how to achieve what i have just stated.
https://community.flexerasoftware.com/archive/index.php?t-162141.html
https://community.flexerasoftware.com/archive/index.php?t-188807.html
Take
We can write a InstallScript code as well to achieve this. Please refer the code below :
function CheckRunningProcessAndTerminate(hMSI)
// To Do: Declare local variables.
OBJECT wmi,objProc;
STRING szProcessName;
begin
// To Do: Write script that will be executed when MyFunction is called.
szProcessName = "Excel.exe";
set wmi = CoGetObject("winmgmts://./root/cimv2", "");
set objProc = wmi.ExecQuery("Select * from Win32_Process where Name = '" + szProcessName + "'");
if (objProc.count > 0) then
MessageBox("Process is running.", INFORMATION);
//kill proces
TerminateProcesses(szProcessName);
//objProc.Terminate(); //I tried this, but it didn't worked.
else
MessageBox("Process is not running.", INFORMATION);
endif;
end;
I have been trying both ShellExecute and CreateProcess to Launch a game - My goal is to hide the game window. The game is built using DirectX9. For some reason I am struggling on this issue. I am using the following codes independently but without success
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = app_exe; // Path to game
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_HIDE;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
And with CreateProcess
ZeroMemory(&procInfo, sizeof(PROCESS_INFORMATION));
ZeroMemory(&startupInfo, sizeof(STARTUPINFO));
startupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
startupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
startupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
startupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
startupInfo.wShowWindow = SW_HIDE;
CreateProcess(app_exe, cmdline, NULL, NULL, FALSE,CREATE_NO_WINDOW , NULL, NULL,&startupInfo, &procInfo);
WaitForSingleObject(procInfo.hProcess, INFINITE);
In both cases the game is launched and I get a full-screen game.
Is there anything wrong that I am doing?
The STARTUPINFO.wShowWindow flag ends up in WinMain as the final parameter nCmdShow (https://msdn.microsoft.com/en-us/library/windows/desktop/ff381406(v=vs.85).aspx). There is no requirement that the created process adheres to this request. It is free to create as many visible windows as it likes. In fact, it's commonplace to completely ignore this flag. If you have the source code to the application being launched, and can recompile it, you could make it respect this request.
Also, I haven't tried it, but I would think that attempting to hide a DirectX fullscreen window will likely fail, and/or cause issues.
I want to disable the screens in dialog tab, but I also want that the installer doesn't show any screen.
From commandline and install silently.
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
ProcessStartInfo psi = new ProcessStartInfo();
psi.Arguments = "/s /v /qn /min";
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = desktopPath + "\\" + "Tabcontrol.exe";
psi.UseShellExecute = false;
Process.Start(psi);
If you run an installshield setup in silentmode it requires a record file that contains the information the setups needs. It is not really initially silent it's more like unattended and silent.
Here you can find the information how to create this recordfile: http://helpnet.installshield.com/installshield16helplib/CreatetheResponseFile.htm
Here you will find everything you need to know about any unattended/silent setup: http://unattended.sourceforge.net/installers.php
I am using InstallShield installscript project.
My problem is I want to set a registry key when the cancel button is pressed in the "Preparing to install" dialog.
I have placed the below code in the OnCanceling() event. but it deletes the registry key.
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
szKey = "Software\\Test\\Uniinst";
szName = "Cancel" ;
szValue = "1";
RegDBSetKeyValueEx ( szKey, szName, REGDB_NUMBER , szValue, -1 );
Please let me know what I am doing wrong???
After searching a lot i came to know that "abort" keyword in OnCanceling() event calls the silent uninstallation. so that it delete my registry entry.
To prevent deletion of registry from uninstallation i used Disable(Logging)...
it should be used just before the registry that we don't want to delete during uninstallation.
after that we have to use Enable(Logging)...
Finally, Using these two statement my Code look like this...
Disable(Logging); //prevent registry deletion during Uninstallation
szKey = "Software\\Test\\Uniinst";
szName = "Cancel" ;
szValue = "1";
RegDBSetKeyValueEx ( szKey, szName, REGDB_NUMBER , szValue, -1 );
Enable(Logging);
Thanks.....
System setup:
3-Tier environment
Client Machine - doesn't matter
Web-Tier - Not sure. Probably Windows Server 2008 64 bit
-Jdk 7u3
App Server - Windows Server 2008 64 bit
-Weblogic Server 10.3.6
-Excel 2010
-Jdk 7u3
Database Server - Not sure. Probably Windows Server 2008 64 bit.
-Oracle Database 11g
Programming using Oracle Forms 11.1.1.6
Now, my problem is that when we had designed they system, everything but the database was on one PC. I was able to read and write Excel documents no problem at all. Then we moved everything to a tiered setup where we had the client, app server and database server. Everything still worked great. Finally they set up the 3-tiered system and that's where I ran into my problems.
When I have Oracle Forms write to the Excel document the code appears to execute without any errors until I try to copy the file from the App Server using Webutil.
PROCEDURE Export_to_Excel IS
-- Declare the OLE objects
application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
--cell OLE2.OBJ_TYPE;
range OLE2.OBJ_TYPE;
range_col OLE2.OBJ_TYPE;
-- Declare handles to OLE argument lists
args OLE2.LIST_TYPE;
p_filename VARCHAR(255);
--p_file TOOL_RES.RFHANDLE;
p_file Text_IO.File_Type;
p_filename_client VARCHAR2(500);
v_filename VARCHAR2(500);
v_error VARCHAR2(500);
passed_filename VARCHAR2(500);
BEGIN
-- Retrieve user specific directory to create new file in
p_filename := Webutil_file_transfer.get_work_area;
-- Start Excel
application:=OLE2.CREATE_OBJ('Excel.Application');
-- Return object handle to the Workbooks collection
workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
-- Add a new Workbook object to the Workbooks collection
workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
-- Return object handle to the Worksheets collection for the Workbook
worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
-- Set up the Header worksheet
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 1);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
OLE2.set_property(worksheet,'Name','Header');
-- Build header form
populate_header(worksheet);
-- Autofit columns
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
-- Set up the Item worksheet
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 2);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
OLE2.set_property(worksheet,'Name','Item List');
-- Build Item sheet
populate_item_sheet(worksheet);
-- Delete the last worksheet that excel automatically creates
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 3);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
OLE2.invoke(worksheet, 'Delete');
-- Save as worksheet
OLE2.SET_PROPERTY(application,'DisplayAlerts',FALSE);
IF p_filename is not null THEN
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG( args, p_filename || :PARAMETER_B1.FILENAME || '.xlsx');
OLE2.ADD_ARG( args, 56 );
OLE2.INVOKE( workbook,'SaveAs',args );
OLE2.DESTROY_ARGLIST( args );
END IF;
-- Close workbook
OLE2.INVOKE( workbook ,'Close');
-- Release the OLE objects
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.INVOKE(application, 'Quit');
OLE2.RELEASE_OBJ(application);
--Check if file was writen correctly
p_file := text_io.fopen(p_filename || :PARAMETER_B1.FILENAME || '.xlsx','r');
Text_IO.Fclose(p_file);
--Added the following code
passed_filename := :PARAMETER_B1.FILENAME || '.xlsx';
v_filename := p_filename || passed_filename;
-- Popup a dialog box to allow user to select the location to save the file
p_filename_client := CLIENT_GET_FILE_NAME ( 'C:\', passed_filename, NULL, 'Select A Directory', SAVE_FILE, FALSE );
if p_filename_client is null then
message ('Creation of the spreadsheet has been canceled.');
raise form_trigger_failure;
end if;
-- File Transfer to Client
PROCESS_COMM_FILE_CLIENT.FILE_TRANSFER('O', p_filename_client, v_filename, null, v_error);
EXCEPTION
WHEN others THEN
Text_IO.Fclose(p_file);
message( SQLERRM( SQLCODE ) ) ;
if p_filename_client is not null then
MESSAGE('An error occurred while creating file.');
end if;
END;
The code fails at the FILE_TRANSFER because the form does not get created on the App Server like it is supposed to.
A related problem that is occuring is that when I try to upload the excel document and read it in to oracle I get a ORA-305500 error. I have tried to have the DBA uninstall and reinstall Excel and made sure all of the features/add-ons were included during the installation but the problem still hasn't been fixed.
Could someone please give me some suggestions on what to do to fix this problem or continue to problem shoot this?
Thanks,
Bill
If the problem relates to the actual generation of the file using OLE, then I would sugest that you create the directory:
C:\Windows\System32\config\systemprofile
The OLE code in Oracle Forms checks in this directory for OLE configuration settings. It doesn't matter if the directory is empty, only that it exists!
Check your $ORACLE_HOME/forms/server/webutil.cfg, if there is any restriction in reading directories.
Basically, check the parameters "transfer.appsrv.read.<n>=/.../.../".
If I am understanding your problem, you intend to save the file in the client machine. Now assuming you are using WEB_FORMS (i.e. you use a web browser to access forms application), you can use the code below to save the file from AS to client machine, instead of PROCESS_COMM_FILE_CLIENT.FILE_TRANSFER. The OLE objects create the file at the AS, you need to get the file from AS (App server) to local machine-
l_success := webutil_file_transfer.AS_to_Client_with_progress
(clientFile => 'c:\fine.xlsx'
,serverFile => 'c:\data\file.xlsx'
,progressTitle => 'Save file in progress'
,progressSubTitle => 'Please wait');
if l_success then
message('File saved successfully');
else
message('Cannot save file');
end if;
The abve code should show a "Save file in progress" pop up box with progress bar to show that your file is being saved to local machine.