[Q] How to replace \Windows\ .dlls

Search This thread
D

Deleted member 1890170

Guest
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
 

aiiro

Senior Member
Mar 20, 2008
313
29
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
 
D

Deleted member 1890170

Guest
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 a moderator:
  • Like
Reactions: prabhat

aiiro

Senior Member
Mar 20, 2008
313
29
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.
 
D

Deleted member 1890170

Guest
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.
 
  • Like
Reactions: prabhat and aiiro

aiiro

Senior Member
Mar 20, 2008
313
29
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?
 
D

Deleted member 1890170

Guest
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 \Windows might be located in ROM, or not ( i.e. located in RAM - folder \Windows 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"
[COLOR="Red"]C "\NandFlash\MyCESystemPath\mscoree.dll" "\Windows\mscoree.dll"[/COLOR]

; 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 a moderator:

aiiro

Senior Member
Mar 20, 2008
313
29
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.
 

Cheetah64d

Member
Apr 28, 2011
47
0
I want to copy a new NLS file to a WinCE device, before system was loaded.
I've tried to do what you suggested here, jwoegerbauer, with my Mio C520.
I've wrote registry keys to activate the sciprt I wrote, before the system loaded - with no success.
I've tried both MortScript and TULL as script-language - both with no success.
The registry keys that I've tried to import are:

Code:
[HKEY_LOCAL_MACHINE\init]
"Launch25"="\My Flash Disk\Temp\CopyNLS.exe"

I've tried also to import
Code:
"Depend25"=hex:14,00
which cause the system to freeze in the main menu (before MP is loaded), and
Code:
"Depend30"=hex:14,00,28,00
which cause the system to freeze in the boot load.
I'll be happy to know what else can I try to activate the code.
 

tobbbie

Senior Member
Jan 5, 2007
1,452
252
Stuttgart
If the wince.nls is located in the XIP already you cannot override it. It is loaded before the FAT partition is there and the filter driver could redirect calls to the FAT copy of a dll.
You need to re-cook with the wince.nls moved to the SYS, seems however that some specialties need to be taken care of when doing so (search here at XDA for this).
 
  • Like
Reactions: Cheetah64d

Cheetah64d

Member
Apr 28, 2011
47
0
So, I understand that my only option is to implant a soft-reset during the installaion of MioPocket.
Do you know how to do soft-reset with those chinese devices?
 

tobbbie

Senior Member
Jan 5, 2007
1,452
252
Stuttgart
Reset does not help you if the wince.nls is located in the XIP. You will not be able to replace it with any means - the OS will load it before you have any chance to interfere.

Your only option is to replace the OS (with a cooked one) where the wince.nls is different from the start - or where it is not located in the XIP partition.

Why do you want to replace the wince.nls? Probably your problem can be solved another way?
 
  • Like
Reactions: Cheetah64d

Cheetah64d

Member
Apr 28, 2011
47
0
Well, actually, in the Mio C520 - reset does help me. It's re-written the wince.nls file with the one I copied, and used it very well.
My problem now is my Chinese device, based on WinCE 6.0 embedded.
I've installed MioPocket on it, and translate some of the words to Hebrew. The problem is that the hebrew is 'backwards', meaning if for ex. instead of "Hello" - It'll show "olleH".

Here is screenshot of both devices, to the left is the Mio C520, which is OK, and to the right is the Chinese device, which is written 'backwords'

hstEv393


So I thoght - maybe, if I'll made the Chinese device to do soft-reset, just like the Mio - maybe the problem will be solved.
But maybe you are right, and there's completely another solution to this problem. I sure hope there is...
 

tobbbie

Senior Member
Jan 5, 2007
1,452
252
Stuttgart
Well, I can neither read Chinese nor Hebrew - so nothing to guide you here.

Not sure what you wanted to achieve with the new wince.nls
What I understood is that this files basically gives you all the entries in the Locale panel of the settings file - so where you can select the format of the time/date or currency. First you select the Locale (not UI language which is a different setting) and then you can pick for each of the items defined by this locale set the relevant options that are stored in the wince.nls file. It also holds all menu items of that local setting in all languages - which makes it quite big depending on the number of languages supported.
So if you could "replace" the wince.nls, then for sure it is not in the XIP and all my previous comments are useless for you.

If you are after swapping the direction of writing on your device this is a totally different thing. I am sure it is not part of the .nls but a system setting for the UI part of the device. You may need to search for "Arabic Support" or alike in the Windows CE forums around the world. I have not seen much discussed here at XDA for this specialty.

Good luck!
 

Cheetah64d

Member
Apr 28, 2011
47
0
After a search inside the GPS file system (I forgot to mention that in the original menu of the GPS the Hebrew was just fine - meaning from right to left - what led me to think there's something in the OS responsible for that) - I found a file named SetLanguage.exe which may be repsosible to display the hebrew in the right direction.

Anyone in here can hex the file and understand what's it's usage?

I attached also file named Arab.dll, maybe is also related..

Any help will be much appriciate!
 

Attachments

  • SetLang.rar
    21.1 KB · Views: 48
D

Deleted member 1890170

Guest
Absolute OFF-TOPIC

@Cheetah64d

SetLanguage.exe (by Lenovo Beijing Ltd.) you attached depends on libraries
Arab.dll, MultiLanDll.dll, ApicalDrvApi.dll, AppLoginDll.dll, MFC80U.dll and COREDLL.dll.
This executable is only useable on very specific devices.

As stated by MS, Windows CE by default uses the fonts as listet next to implement hebrew
Arial (subset 1_08) arial_1_08
Arial Bold (subset 1_08) arialbd_1_08
Courier New (subset 1_08) cour_1_08
Tahoma (subset 1_08) tahoma_1_08
Tahoma Bold (subset 1_08) tahomabd_1_08
 
Last edited by a moderator:

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    D
    Deleted member 1890170
    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 \Windows might be located in ROM, or not ( i.e. located in RAM - folder \Windows 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"
    [COLOR="Red"]C "\NandFlash\MyCESystemPath\mscoree.dll" "\Windows\mscoree.dll"[/COLOR]
    
    ; 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
    2
    D
    Deleted member 1890170
    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.
    1
    D
    Deleted member 1890170
    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
    1
    If the wince.nls is located in the XIP already you cannot override it. It is loaded before the FAT partition is there and the filter driver could redirect calls to the FAT copy of a dll.
    You need to re-cook with the wince.nls moved to the SYS, seems however that some specialties need to be taken care of when doing so (search here at XDA for this).
    1
    Reset does not help you if the wince.nls is located in the XIP. You will not be able to replace it with any means - the OS will load it before you have any chance to interfere.

    Your only option is to replace the OS (with a cooked one) where the wince.nls is different from the start - or where it is not located in the XIP partition.

    Why do you want to replace the wince.nls? Probably your problem can be solved another way?