Jump to content











Photo
- - - - -

dll and ocx


  • Please log in to reply
79 replies to this topic

#1 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 25 July 2007 - 11:27 AM

When a program requires a certain dll from system32, it's usually good enough, to copy that dll into the application folder, to make the app more 'portable'.
However those stupid ocx files make trouble. It seems like they refuse to work without the proper registry keys.

Any bright ideas how to get them to work? Best without having to write to registry first.

:yahoo:

#2 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 25 July 2007 - 12:03 PM

Hi MedEvil, I join your doubts about this question.


I've been trying to find a way to register OCX files inside a target windows but it seems that there isn't a specific way of doing this task.

RegSVR32 has to be used and it will do the appropriate installation of the DLL or OCX file.

http://www.microsoft...2.mspx?mfr=true

Would be really great to have a way to do this without resorting to regsvr32 and apply it on the hives and system32 folder that we're creating.. :yahoo:

---------------------------------

Looking on microsoft.com - they've documented how this process works and even posted a snippet that can be used as example: http://support.micro...om/kb/207132/en

RegSvr32.exe calls the following Win32 functions in this order:
• OleInitialize
• LoadLibrary to load the DLL
• DllRegisterServer or DllUnregisterServer
• FreeLibrary
• OleUninitialize
Most often, RegSvr32.exe fails because the LoadLibrary, DllRegisterServer, or DllUnregisterServer function fails. LoadLibrary can fail if the DLL is not in the specified path, or if the specified path is incorrect. LoadLibrary can also fail if one of the dependencies of the DLL that you are trying to load is not met; in other words, if a dependent DLL is not present or is not in the specified path.

NOTE: You can use the Depends.exe tool to check whether or not all of the dependencies of your DLL are met. Depends.exe is included with the Microsoft Platform Software Development Kit (SDK), which ships with Microsoft Visual Studio.

Your DLL must implement DllRegisterServer and DllUnregisterServer, which contain the logic that is necessary to add or delete the required registry entries for the COM component. RegSvr32.exe finds the entry point to these functions, and calls them appropriately.


OCX also seems capable to be intercepted - I don't have any experience with this part, but can't these functions be recorded on the host machine and then replicated on the target windows? :)

http://support.micro...om/kb/249873/en

Maybe some developers can better make use of this information and develop an alternative to regsvr32 that can register OCX and DLL files into our target windows.

:)

Edited by Nuno Brito, 25 July 2007 - 12:10 PM.
Added info from MS KB


#3 Moon Goon

Moon Goon

    Frequent Member

  • Advanced user
  • 270 posts

Posted 25 July 2007 - 12:03 PM

I think you could make a batch file like this:

REGSVR32.EXE BOOBERSNAP.OCX
FLOGDOLP.EXE


BOOBERSNAP.OCX
being your OLE Control Extension and FLOGDOLP.EXE being the program to run.

Unfortunately, the whole point of REGSVR32.EXE is to mess with the registry, so I'm not sure how it would run under a PE environment.

UPDATE: Looks like Nuno posted a better answer at the same time I did :yahoo:

Okay, then my second suggestion is to use InstallRite from WinPE and
A. Install the program and capture its changes to create an instant install *just* for WinPE. Or
B. Install the programs and capture its changes so you can figure out how to manually integrate the files/registry changes needed.

I think this is a link to a WinBuilder script for Installrite:
http://www.boot-land...?showtopic=2537

#4 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 25 July 2007 - 01:12 PM

The ocx problem is solvable unter PE, by using the registry i guess.
My problem lies more in another area.
I create my BootCDs in a way that gives me not only access to my apps, when i booted from CD, but also under real XP via autostart und NuMenu.

Though most apps i use are not greenware and write to the registry of the 'host' system, they do not write data that can cause trouble. But those ocx entries can and do. Besides that, the problem exists that upon registring, my versions possibly overwrite the settings for the installed ones. :yahoo:

:)

#5 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 25 July 2007 - 07:05 PM

FYI:
http://www.softcircu...com/sw_apps.htm

Control Registration Utility 2.00
RegCtrls (Register Controls) allows you to selectively register and unregister OLE controls with the system registry. RegCtrls is a GUI replacement for Microsoft's REGSVR32 command-line utility. RegCtrls uses its Windows interface to provide easier access to features and also provides functionality not available with Microsoft's command-line utility.


http://staff.develop...gie/readme.html

Reggie
an alternative to Microsoft's RegSvr32.exe (and RegTLib.exe)


http://www.ureader.c...ge/1084868.aspx

I wrote some code that would essentially do the following:

- build a list of registry keys to monitor
- run DllUnregisterServer on the DLL
- capture the state of monitored registry keys
- run DllRegisterServer on the DLL
- build a difference list of monitored keys

This is incorporated into izfree, but I don't know how useful that
would be to you. You can look at the vbscript and see how the
izMonitor.exe COM object works and maybe repurpose it to your own
needs. <http://izfree.sourceforge.net>


http://izfree.sourceforge.net/

jaclaz

#6 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12701 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 25 July 2007 - 07:13 PM

It looks like that besides MedEvil nobody understood the real issue:

It is possible to install in the PE an autostart, RunOnce or similar mechanism which does the regsrv32 <myDLL>

But currently there is no way known to register the OCX / DLL into a remote hive inside %TargetDir% or to register it into a hive which is mounted as "WB-HIVE" in the local registry.
That must be done w/o changing the local registry.

The first choice would (with many OCXSes) enlarge the boot time remarkably.
The second choice would be done once during PE build and has no effect on boot time.

Peter

#7 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 25 July 2007 - 09:47 PM

I think we'all understood what MedEvil meant, but Jaclaz gave very good hints to fetch some good answers.. :)

While reading the pages mentioned by him I've stumbled on this interesting comment here:

Re: Capture Registry Keys from Regsvr32.exe

I did something a while back - it's here:

http://www.installsi...en/msi/tips.htm

scroll down to Capture Self Registration Information. It uses the Windows
2000 API RegOverridePredefKey to cause the registry entries to redirect to
another location.
--
Phil Wilson [MVP Windows Installer]



Looking on the site mentioned: http://www.installsi...en/msi/tips.htm

RegSpy

This program (formerly known as RegIt) captures COM registration entries for DLLs, OCXs and EXE COM servers. In general, it works by using the RegOverridePredefKey on Windows 2000 to redirect registry entries to another registry area.

1. It takes the path to the Dll as a command line argument.
2. Loads the Dll and looks for DllRegisterServer to call.
3. Redirects HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE registry entries to
HKEY_CURRENT_USER\Software\Unisys\Registry\<dllname>\HKCR and
HKEY_CURRENT_USER\Software\Unisys\Registry\<dllname>\HKLM.

In contrast to other registry monitor solutions it doesn't need any drivers. Source code is included in the package.

Update: Now can output a .reg file for import in MSI authoring tools. Source code requires Visual Studio .NET 2003.

http://www.installsi...swi/RegSpy2.zip

Original version (source code works with Visual Studio 6.0):
http://www.installsi...iswi/RegSpy.zip

Written by Phil Wilson



I think Jaclaz hit the jackpot, thanks for the links! :yahoo:

btw: regctrls from http://www.softcircu...com/sw_apps.htm is a very app to disable malware "registered" in your system or just debug installed activex, quite handy.. :)

#8 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12701 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 26 July 2007 - 08:20 AM

I think Jaclaz hit the jackpot, thanks for the links! :yahoo:

And Nuno took the right piece out of the jackpot: RegOverridePredefKey.

Today I'm out, but I thing tomorrow evening we have a Delphi program doing the register into a mounted hive.

Peter


#9 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 26 July 2007 - 10:43 AM

Good to hear that! :yahoo:

Look here too:


[quote]It all started when I felt the need for a tool that could :-

1. Register COM servers only for the current user
2. Create a .reg file instead of registering the COM server. I needed this for creating a windows installer package.

I found an answer for the second problem in the tool RegCap.exe which comes with Microsoft Visual Studio.NET. This tool can be found in the sub directory - \Common7\Tools\Deployment within the main installation directory of Visual Studio.NET. If you want to create a .reg file instead of registering a COM server (dll or an exe), you can simply invoke this tool from the command prompt as:-

unit DLLRegister;interfacefunction DllServer(const ADll: string; const ARegister: boolean = true): boolean;implementationuses  Windows, OSVersion, Registry, IsAdministrator;type  TDllRegisterServer = function: HResult; stdcall;  TRegOverridePredefKey = function(AKey, ANewKey: HKEY): longint; stdcall;function RegOverridePredefKey(AKey, ANewKey: HKEY): longint;var  iDll: integer;  pROPK: TRegOverridePredefKey;begin  Result := ERROR_INVALID_FUNCTION;  iDll := LoadLibrary(advapi32);  if iDll <> 0 then    try      pROPK := GetProcAddress(iDll, &#39;RegOverridePredefKey&#39;);      if Assigned(pROPK) then        Result := pROPK(AKey, ANewKey);    finally      FreeLibrary(iDll);    end;end;function _DllRegisterServer(const ADll: string; const ARegistering: boolean = true): boolean;var  iDll: integer;  pDRS: TDllRegisterServer;  strRegister: string;begin  if ARegistering then    strRegister := &#39;DllRegisterServer&#39;  else    strRegister := &#39;DllUnregisterServer&#39;;    Result := false;  iDll := LoadLibrary(pAnsiChar(ADll));  if iDll <> 0 then    try      pDRS := GetProcAddress(iDll, PAnsiChar(strRegister));      if Assigned(pDRS) then        Result := pDRS = S_OK;    finally      FreeLibrary(iDll);    end;end;function OverrideRegistryKey(const ARegister: boolean): boolean;var  hNewHive: HKEY;begin  if ARegister then  begin    RegOpenKeyEx(HKEY_CURRENT_USER, &#39;Software\Classes&#39;, 0, KEY_ALL_ACCESS, hNewHive);    try      Result := RegOverridePredefKey(HKEY_CLASSES_ROOT, hNewHive) = ERROR_SUCCESS;    finally      RegCloseKey(hNewHive);    end;  end  else    Result := RegOverridePredefKey(HKEY_CLASSES_ROOT, 0) = ERROR_SUCCESS;end;function DllServer(const ADll: string; const ARegister: boolean = true): boolean;var  swvVersion: TWindowsVersion;  fNT: Boolean;begin  swvVersion := GetWindowsVersion;  fNT := (swvVersion.KernelType = wktNT) and (swvVersion.MajorVersion >= 5);  Result := false;  if fNT then  begin    if ARegister then    begin      if OverrideRegistryKey(true) then      begin        try          Result := _DllRegisterServer(ADll, ARegister);        finally          OverrideRegistryKey(false);        end;      end      else if not IsAdmin then        exit      else        Result := _DllRegisterServer(ADll, ARegister);    end    else    begin      Result := _DllRegisterServer(ADll, ARegister);      try        Result := Result or _DllRegisterServer(ADll, ARegister);      finally        OverrideRegistryKey(false);      end;    end  end  else    Result := _DllRegisterServer(ADll, ARegister);end;end.
http://www.koders.com/delphi/fid0AA937CD01...5DD9F341B0.aspxMore snippets
type   // this function maps a predefined key to the argument; used for chrooting a key   // to a new hive in the registry. this only affects the calling process!   function RegOverridePredefKey(a_hKey: HKEY;         // predefined key [HIVE]         a_TargethKey: HKEY): Longint; stdcall;      // OPEN! key. all calls to HIVE will end up hereimplementation   function RegOverridePredefKey(a_hKey: HKEY; a_TargethKey: HKEY): Longint; external &#39;advapi32.dll&#39; name &#39;RegOverridePredefKey&#39;;
http://www.delphipraxis.net/post168989.html (german forum)Maybe this way DLL's and OCX files can directly write the target hives?And a more recent app along with source code to export all registry entries to a .reg file (along with some explanations how it works..)http://vagmi.supersized.org/archives/13-Sp...ry-Entries.html[quote]Spying on Registry EntriesI am probably letting out the best kept secret of installation industry. I always used to wonder and have now discovered how most of the installation tools spy on registry entries that are created during COM registration or similar processes without actually affecting the build system. The spying program creates temporary registry keys for each of the registry hives HKCR, HKLM, HKCU, HKU and it maps the registry hives to these temporary registry keys. It then triggers the registration function which creates registry entries withing the registry keys specified instead of including it in the hives. I came across this revelation while I was wading through the source code for Tallow in the WIX toolset.The core of this spying exercise relies on functions exposed by the advapi32.dll. The actual hive to key mapping is performed by the RegOverridePredefKey() function. The handle to the registry key is passed by using the RegCreateKeyEx() or the RegOpenKeyEx() function. After the mapping is done, you can invoke the DllRegisterServer() function after loading the library using the LoadLibrary() function. This mapping would be active for all the registry entries created by that particular process. So out of process registration for exe files may not directly work with this method. For the sake of simplicity, I am going to extract COM Interop settings from a given assembly. So let us write a simple console app in C# to do this. This app would perform the mapping and write the registry entries to a REG file and wipe out the key after the file is written.Extracting registration information from a DLL file is similar but involve the importing other functions from Kernel32.dll. So I am giving that a raincheck now. You can download the Wix toolset's source package if you are interested.[/quote]


Paraglider also has quite some expertise on this area..
http://www.911cd.net...?showtopic=5252
http://www.paraglide.../runscanner.htm


:)

#10 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 26 July 2007 - 02:39 PM

@psc
Let's put it this way, if we were an antivirus:
MedEvil wold be the change detection monitor
I would be the heuristic engine
Nuno would be the scanner
you would be the patching engine

:)

:yahoo:

jaclaz

#11 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 26 July 2007 - 02:47 PM

:yahoo:

#12 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 26 July 2007 - 09:11 PM

Since at the moment we seem to be all at the same wavelenght and have the same ideas. I feel the need to post something before it is really usuable.

But why MedEvil, you've never done this before? :)

Well Peter scared me yesterday when he jumped right on the idea and said he will start coding tomorrow. :yahoo:

Since my experience, with my evilPE project and H7se, showed me, that i'm appearantly lack the time to score a first place in the development races at the moment, :)
i post my idea here for others to make use of it.

The idea is something Nuno and i talked about at the weekend.
A way to make software, all software, portable.
The two script files that i include, take care of creating an extra environment and making sure the applications can be installed into it and run exclusivly from it. What is still missing, is the program that does the same for the Registry via RegOverridePredefkey.

This program will have to map the 4 main keys to 'our' 4 main keys. Biggest problem seems to be to get a persistent mapping that endures for more than just one process, or to be more precise, can be inherited by child processes.

The Regisrty Changer

=====================

RegOverridePredefKey &#40;HKEY_CLASSES_ROOT, HKEY_CURRENT_USER\SOFTWARE\MedEvil\HKEY_CLASSES_ROOT&#41;

RegOverridePredefKey &#40;HKEY_CURRENT_USER, HKEY_CURRENT_USER\SOFTWARE\MedEvil\HKEY_CURRENT_USER&#41;

RegOverridePredefKey &#40;HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER\SOFTWARE\MedEvil\HKEY_LOCAL_MACHINE&#41;

RegOverridePredefKey &#40;HKEY_USERS, HKEY_CURRENT_USER\SOFTWARE\MedEvil\HKEY_USERS&#41;

RegOverridePredefKey &#40;HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER\SOFTWARE\MedEvil\HKEY_CURRENT_CONFIG&#41;



Release a mapping&#58; RegOverridePredefKey &#40;HKEY_CURRENT_CONFIG, NULL&#41;


Now to the cool part about this whole thing.
We can use this, when we get it off the ground, to produce the eassiest fully automated application script builder!
After installing 1 app into our environment, we will have all installed files together with all the right places and of course all created registry keys.
One could just simply install a software like usual and then set it up properly, before starting the script creating process.
Done!

:)

Make.cmd
REM create directory structure in %CD% folder

REM-------------------------------------------

md &#34;%CD%\Windows\Downloaded Program Files&#34;

md &#34;%CD%\Windows\Fonts&#34;

md &#34;%CD%\Windows\inf&#34;

md &#34;%CD%\Windows\installer&#34;

md &#34;%CD%\Windows\Macromed&#34;

md &#34;%CD%\Windows\System&#34;

md &#34;%CD%\Windows\System32&#34;

md &#34;%CD%\Windows\Temp&#34;



md &#34;%CD%\ProgramData\CommonFiles&#34;



md &#34;%CD%\Users\All Users\Application Data&#34;

md &#34;%CD%\Users\All Users\Desktop&#34;

md &#34;%CD%\Users\All Users\My Documents\My Pictures&#34;

md &#34;%CD%\Users\All Users\My Documents\My Music&#34;

md &#34;%CD%\Users\All Users\Favorites&#34;

md &#34;%CD%\Users\All Users\Local Settings&#34;

md &#34;%CD%\Users\All Users\SendTo&#34;

md &#34;%CD%\Users\All Users\Start Menu&#34;

md &#34;%CD%\Users\All Users\UserData&#34;

md &#34;%CD%\Users\All Users\Templates&#34;



md &#34;%CD%\Users\MedEvil\Application Data&#34;

md &#34;%CD%\Users\MedEvil\Cookies&#34;

md &#34;%CD%\Users\MedEvil\Desktop&#34;

md &#34;%CD%\Users\MedEvil\My Documents\My Pictures&#34;

md &#34;%CD%\Users\MedEvil\My Documents\My Music&#34;

md &#34;%CD%\Users\MedEvil\Favorites&#34;

md &#34;%CD%\Users\MedEvil\Local Settings\Application Data\Microsoft&#34;

md &#34;%CD%\Users\MedEvil\History&#34;

md &#34;%CD%\Users\MedEvil\Temporary Internet Files&#34;

md &#34;%CD%\Users\MedEvil\SendTo&#34;

md &#34;%CD%\Users\MedEvil\Start Menu\Programs\Startup&#34;

md &#34;%CD%\Users\MedEvil\UserData&#34;

md &#34;%CD%\Users\MedEvil\Templates





REM create MedEvil.reg

REM--------------------

ECHO> MedEvil.reg REGEDIT4

ECHO>>MedEvil.reg &#91;HKEY_CURRENT_USER\SOFTWARE\MedEvil&#93;





REM create Delete.reg

REM-------------------

ECHO> Delete.reg REGEDIT4

ECHO>>Delete.reg &#91;-HKEY_CURRENT_USER\SOFTWARE\MedEvil&#93;

Run.cmd
REMdelete RegKey

REM--------------

regedit.exe /s %CD%\Delete.reg



REMInstall Regkey

REM---------------

regedit.exe /s %CD%\MedEvil.reg



REM Set Environment

REM-----------------

Set ALLUSERSPROFILE=&#34;%CD%\Users\All Users&#34;

Set USERPROFILE=%CD%\Users\MedEvil

Set HOMEDRIVE=%CD%

Set SystemDrive=%CD%

Set SystemRoot=%CD%\WINDOWS

Set windir=%CD%\WINDOWS

Set ProgramFiles=%CD%\ProgramData

Set CommonProgramFiles=%CD%\ProgramData\CommonFiles

Set HOMEPATH=\Users\MedEvil

Set APPDATA=&#34;%CD%\Users\MedEvil\Application Data&#34;

Set Path=%CD%\Windows\system32;%CD%\Windows;C&#58;\WINDOWS\system32;C&#58;\WINDOWS;C&#58;\WINDOWS\System32\Wbem



REM Temp should best left to point to HDD,If you&#39;re paranoid, enable the settings below;-&#41;

// Set TEMP=C&#58;\DOCUME~1\MedEvil\LOCALE~1\Temp

// Set TMP=C&#58;\DOCUME~1\MedEvil\LOCALE~1\Temp



REM Start Explorer

REM---------------

RegReMapper Explorer.exe



REM save RegKey

REM-------------

regedit.exe /s /e %CD%\MedEvil.reg HKEY_CURRENT_USER\SOFTWARE\MedEvil



REM delete RegKey

REM---------------

regedit.exe /s %CD%\Delete.reg

I think the code of the 2 scripts is clear enough for anyone to understand, except maybe the explorer part.
I use the explorer in this proof of concept to start child processes more easily than it would be possible through the cmd.

#13 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 26 July 2007 - 09:15 PM

A few useful links:
http://www.codeproje...2k/regsvrex.asp
http://geekswithblog...2/01/16583.aspx
http://www.ddj.com/d...ndows/184416328

#14 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 26 July 2007 - 10:59 PM

Excellent coding, looks so simple and yet so efficient! :yahoo:


One question, will the new %SystemRoot% return to original value after the batch file finishes?
Set SystemRoot=%CD%\WINDOWS


Also noticed that perhaps
RegReMapper Explorer.exe
should be executed with the WAIT switch - explorer makes thing simpler indeed.

:)

#15 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12701 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 27 July 2007 - 08:59 AM

A few useful links:
http://www.codeproje...2k/regsvrex.asp
http://geekswithblog...2/01/16583.aspx
http://www.ddj.com/d...ndows/184416328


The first one yesterday forced my decision to do the job!

Peter

#16 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 09:37 AM

One question, will the new %SystemRoot% return to original value after the batch file finishes?

Set SystemRoot=%CD%\WINDOWS

All changes apply only to the used cmd and all child processes. Any program started 'outside' will still have the default environment.

Also noticed that perhaps

RegReMapper Explorer.exe
should be executed with the WAIT switch

Why? The cmd file will not proceed, as long as explorer.exe is not finished.

:yahoo:

#17 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 09:51 AM

The first one yesterday forced my decision to do the job!

Peter

Yes, the first one is the most interesting from the shown code.

But after thinking things over, after a good night sleep, i think RegOverridePredefKey might be usable for the automated script builder, but is not the right solution for running apps directly from a stick.
We would need a behaviour that's a little different.
Regwrites from inside our environment should always write to 'our' Registry in HKCU\Software\WB-Registry,
but reads should be performed in the same way the path variable is used. It should check several places in a predefined order.
First it should be checked if this entry exists in 'our' registry and if not, then it should be looked up in the 'real' one.

I have at the moment no simple idea, how to achive this different behaviour, just for the programs we started through our special application.
Code injection seems to be the way to go, but i have no previous experience with that.

Has anyone a good idea?

:yahoo:

#18 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 27 July 2007 - 10:55 AM

Try this..

@echo off 

explorer.exe

notepad.exe

It will open both apps because no rules are set to wait for explorer to finish - this was the reason why I've mentioned the wait switch - or at least implement a small function on the new app to redirect registry and wait while explorer is running.

:yahoo:

#19 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 11:17 AM

Try this..

@echo off 

explorer.exe

notepad.exe

It will open both apps because no rules are set to wait for explorer to finish - this was the reason why I've mentioned the wait switch - or at least implement a small function on the new app to redirect registry and wait while explorer is running.

:)

Nuno, maybe you should try your script yourself. :yahoo:

To get the behaviour you're implying, it has to go this way.
@echo off 

start explorer.exe

start notepad.exe

:)

#20 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 27 July 2007 - 11:26 AM

No, I really meant launching both app one after the one without waiting to finish and I've only pasted the code from the file below (I have tested it of course).

Isn't this the same on your system? :yahoo:

Attached File  test.bat   37bytes   192 downloads

If not then would this be another Iberic specific behavior? :)

#21 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 12:03 PM

@echo off

explorer.exe

notepad.exe
Will start explorer and only upon closing explorer will start notepad. And only after notepad is closed will finish and close the cmd window.

@echo off

start explorer.exe

start notepad.exe
Will start explorer, then notepad and then finish, without waiting for any of the started processes to finish or to even finish loading. It's a sort of, kick off and forget behaviour.

It's been this way ever since i can remember. Are you running Vista?

:yahoo:

#22 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 12:10 PM

@pcs
Maybe hooks would be a way to go, but i have no clever idea how to bind them just to processes and by them created child processes, we started via our launcher. :yahoo:
http://www.codeproje...tem/Paladin.asp

:)

PS: We can't use the folder the app is running from as determinator, but maybe we can set an environment variable that the hook function could check for? :)

#23 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12701 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 27 July 2007 - 01:24 PM

@pcs
Maybe hooks would be a way to go, but i have no clever idea how to bind them just to processes and by them created child processes, we started via our launcher. :yahoo:
http://www.codeproje...tem/Paladin.asp

:)

PS: We can't use the folder the app is running from as determinator, but maybe we can set an environment variable that the hook function could check for? :)


Let me first finish the RegSvrWB.

It is working functionally ok. But there is still one issue:

The DLLs builtin DllRegisterServer functions write the current location into the registry, that is %TargetDir%\I386\system32.
That will never be found on the PE system.

What I'm now doing:
  • create a key KHCR\WB-Temp and do the register work into this key
  • transfer the key's tree completely into the mounted hive
  • values w/o a path unchanged
  • values with path
  • change type from 0x1 to 0x2
  • change the path to %SystemRoot%\...
[/list]Peter

#24 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10517 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 27 July 2007 - 02:11 PM

Sorry.. but the above posted batch file will launch explorer and also launch notepad at nearly the same time (notepad even comes up first, guess explorer is sluggier..)

Running this file from explorer - the batch console window only closes after both apps are closed.

I'm using Windows XP SP2 Home OEM (Fujitsu Siemens) Portuguese [5.1.2600]



:yahoo:

#25 MedEvil

MedEvil

    Platinum Member

  • .script developer
  • 7771 posts

Posted 27 July 2007 - 02:11 PM

Damn! Didn't think of that, we would need to change the key type and path too. :)
Good that someone keeps watch! :)

:yahoo:




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users