Post Reply

[Q] How to replace \Windows\ .dlls

26th October 2011, 12:02 AM   |  #1  
sidvizioso's Avatar
OP Senior Member
Flag Rome
Thanks Meter: 5
 
193 posts
Join Date:Joined: Oct 2008
More
I want to replace phcanhtc.dll and phcanrc.dll with these dll (http://forum.xda-developers.com/show...97#post5910397) for wm6.5.3 with all fixes but I do not know how to do it.

I've searched on forum without relevant results.

Please help
29th October 2011, 02:55 AM   |  #2  
CEDDTU's Avatar
Junior Member
Thanks Meter: 0
 
21 posts
Join Date:Joined: Nov 2010
me too, i really dont know
14th November 2011, 07:44 AM   |  #3  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 196
 
568 posts
Join Date:Joined: Jul 2009
Why not simply, when device is booting i.e. processing HKLM\init, override old dll-version with new dll-version?

Code:
Launch9999="CopyDLLs.exe"
Depend9999=hex:14,00,1E,00
15th November 2011, 12:35 PM   |  #4  
aiiro's Avatar
Senior Member
Thanks Meter: 28
 
310 posts
Join Date:Joined: Mar 2008
More
Could You elaborate a bit on that information? I mean, what is "CopyDLLs.exe" and how does it work? Where to find more information about it (Google doesn't return much...)? What is the "Depend" key and what does that HEX mean?

TIA
16th November 2011, 03:40 PM   |  #5  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 196
 
568 posts
Join Date:Joined: Jul 2009
Thought the concept behind the solution proposal I outlined above is reconstructable to everyone:

1) you simply add two lines to [HKEY_LOCAL_MACHINE\init] with which an executable ( of your choice, I use freeware TULL.exe for those reasons - you can name it how you want to do it, ex. CopyDLLs.exe ) is started. BTW: 'DependXXXX' is the load order index for 'LaunchXXXX' and 'hex' indicates that it's a binary value.

2) using TULL.exe you create a related .INI-file that is read by TULL.exe (or renamed to CopyDLLs.exe, what I think is more meaningful) with contents like this:

Code:
;overide xyz dll
C "\Save\xyz.dll" "\Windows\xyz.dll"

;done
FYI: TULL.exe you can downlad here
Last edited by jwoegerbauer; 16th November 2011 at 03:47 PM.
The Following User Says Thank You to jwoegerbauer For This Useful Post: [ View ]
16th November 2011, 09:50 PM   |  #6  
aiiro's Avatar
Senior Member
Thanks Meter: 28
 
310 posts
Join Date:Joined: Mar 2008
More
Thank You for that valuable information! I have been using and customizing WM four years now and I have so far understood that it's impossible to replace DLL-s which are in ROM and cannot be overwritten with Resco or similar file manager. Although I don't need it anymore (I would have a year ago), it's still good to know. One question tho, if I may... By asking "what does hex mean" I didn't really mean that, I know there are DWORDs, binary values etc, sorry about that I actually meant what does that value do. But You already answered that. I still wonder, how is that load order index constructed, I mean, how do I know what to put there?

TIA.
17th November 2011, 10:51 AM   |  #7  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 196
 
568 posts
Join Date:Joined: Jul 2009
OverWrite vs. Override
1) You have to distinguish between terms 'overwrite' (i.e. physical replacement) and 'override' (i.e. logical replacement). The method I suggested is to 'override' a DLL before its first use. If a DLL is already loaded, the method of course will NOT work (only the internal DLL counter is incremented by 1)!

2) With regards to how determine DependXXXX value (excerpt from http://msdn.microsoft.com/en-us/library/aa446914.aspx):

The other option for launching an application at boot time is to use the HKLM\Init keys, this requires that the application call back into the operating system by calling SignalStarted( ); to let the operating system know that the application is running. The reason for this is that the HKLM\Init keys have two parts, LaunchXX and DependXX. The LaunchXX key (where XX is a numeric value) simply points at the executable to launch. For example, take the following snippet from my operating system image registry file (once the operating system is built, the complete registry can be examined in text form in the build release folder as reginit.ini)

[HKEY_LOCAL_MACHINE\init]
"Launch10"="shell.exe"
"Launch20"="device.exe"
"Depend20"=hex:0a,00
"Launch30"="gwes.exe"
"Depend30"=hex:14,00


The snippet from the registry above launches three processes, Shell, Device, and GWES. Notice that device.exe (Launch20) has a dependency on Hex:0a (10 decimal). This equates to Launch10, or shell.exe, so the Shell process needs to signal the operating system that it's up and running so that any dependencies (in this case device.exe) can then be started. The same is also true of gwes.exe (launch30), device.exe depends on hex:14 (20 decimal), so GWES can't run until device.exe calls SignalStarted.
The Following 2 Users Say Thank You to jwoegerbauer For This Useful Post: [ View ]
18th November 2011, 01:56 PM   |  #8  
aiiro's Avatar
Senior Member
Thanks Meter: 28
 
310 posts
Join Date:Joined: Mar 2008
More
OK, thank You again for the thorough explanation. I just want to confirm one thing - as far as I understand from that description, it would also be possible to launch an *.exe which will copy and overwrite the original DLL before it's loaded in boot order? I ask because a bunch of the DLL files cannot be overwritten after the device has booted. Like I said, some of the files in ROM can be overwritten and some cannot be. I have so far suspected that the ones that cannot be overwritten cannot be overwritten because a) they are already loaded; b) they are locked by some process. I cannot imagine any other mechanism that distinguishes between one DLL and another. Would it work or am I missing something here?
18th November 2011, 03:29 PM   |  #9  
jwoegerbauer's Avatar
Senior Member
Bavaria (Germany)
Thanks Meter: 196
 
568 posts
Join Date:Joined: Jul 2009
You didn't read it carefully
Again: YOU HAVE TO DISTINGUISH BETWEEN OVERWRITE AND OVERRIDE. We all know that a file located in ROM never can be 'overwritten', but 'overridden', this due to the fact how WinCE searches for a DLL called by an application: 1 -> in directory where the application is located, 2 -> in folder \Windows, 3 -> in folder declared in CE's SystemPath and 4) finally in ROM.
Ending this excursion into the world of WinCE: If you make the desired DLL-copy-operations directly after device.exe (CE 5) / device.dll (CE 6) has done its job (means file system is mounted and ready to be used) you can 'override' each ROM-located DLL if it isn't already lasting (loaded) in RAM, means you simply copy new version of DLL to folder \Windows. BTW: The DLLs you see in [I]\Windows[I] might be located in ROM, or not ( i.e. located in RAM - folder [I]\Windows[I] itself is RAM), this depends on how OEM implemented this.

Only a practical example I've in use:

Code:
;
;increase storage memory (KB)
W \NandFlash\CE-Utilities\SetSystemMemoryDivisionKB.exe, 3072

; delay execution by the passed value in milliseconds
D 1000

;load backlight settings
W \NandFlash\CE-Utilities\regimp.exe, /f:\NandFlash\MyRegistry\backlight.ini /s
W \NandFlash\CE-Utilities\RegFlushKeys.exe

;prepare using .NET CF 3.5 instead .NET CF 2.0 (ROM located)
C "\NandFlash\NetCFCfg\device.config" "\Windows\device.config"
C "\NandFlash\MyCESystemPath\mscoree.dll" "\Windows\mscoree.dll"

; delay execution by the passed value in milliseconds
D 1000
Original ROM-located mscoree.dll (part of pre-installed .NET CF 2.0) gets overriden with mscoree.dll that comes with .NET CF 3.5, thus now .NET CF 3.5 is running instead of .NET CF 2.0
Last edited by jwoegerbauer; 19th November 2011 at 08:40 AM.
The Following 3 Users Say Thank You to jwoegerbauer For This Useful Post: [ View ]
22nd November 2011, 12:02 PM   |  #10  
aiiro's Avatar
Senior Member
Thanks Meter: 28
 
310 posts
Join Date:Joined: Mar 2008
More
Thanks again for Your answer, which is again thorough and informative. Basically You answered "Yes" to my question I say this because - as I am not as knowledgeable about WinCE system as You are - it seems I just call the process that You describe as "overriding" simply "overwriting". This is because I wasn't aware how WinCE searches for a file or how the \Windows\ folder contents is handled / processed. And also because when I copy a DLL file to \Windows\ folder, Resco simply asks "Do You want to overwrite...?" etc I am not a WinCE developer, I'm simply an enthusiast and I might call things more simply, sorry for that. But I think I got valuable information from You one way or another and the most important thing is, I got the point. However You call it.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes