x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

regimp problems

1 2
I dunk for bananas Page Icon Posted 2023-01-29 6:17 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
I've compiled regimp (the program previously only listed for ARM in the SCL), but it doesn't really seem to work the way it's supposed to.

The tool is supposed to take the path of a registry file as an argument and then import it, typically at the startup of the device. My registry file is at \Hard Disk\sample.ini.
Trying to pass this to regimp leads to it getting caught up with the space, leading to only \Hard ending up in the program. This even happens when I surround the path with parentheses.

But even when I place a registry file at the root of my device (\sample.ini) and try to import it through the GUI by typing in the file name, it will give me an error. However, when I select "open" and browse and select the exact same registry file, it will work just fine. It has an address bar that's supposed to show the current file. No difference is visible when one types in a path vs. when one selects a file through the "open" dialogue.

The fact that you can seemingly only import registry files via the "open" dialogue makes it very cumbersome for its intended purpose, quickly restoring the registry of a device with volatile memory.

Any ideas perhaps? The source code is freely available

Edit: When I copy my registry file to the root of the system and pass it the path with no leading \, it imports fine. So a workaround could be to run a batch file at boot that first copies the registry file to the root, before importing it.

Edited by I dunk for bananas 2023-01-29 6:42 PM
 Top of the page
C:Amie Page Icon Posted 2023-01-29 6:25 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,985
Location:
United Kingdom
Status:
What is the contents of sample.ini (please just post the first 5 lines if it is a big file)

Where did sample.ini come from?

What are the exact commands you are typing on the CLI? You don't usually use parentheses on a DOS prompt, they're used for procedural definitions not string escaping.
 Top of the page
torch Page Icon Posted 2023-01-29 6:27 PM
#
Avatar image of torch
Subscribers
H/PC Guru

Posts:
5,731
Location:
United StatesĀ 
Status:
Can you also upload your compilation here and when I have time I can try and replicate this for you?
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 6:31 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
Quote
C:Amie - 2023-01-29 6:25 PM

What is the contents of sample.ini (please just post the first 5 lines if it is a big file)

Where did sample.ini come from?

What are the exact commands you are typing on the CLI? You don't usually use parentheses on a DOS prompt, they're used for procedural definitions not string escaping.


This is most of sample.ini:

;REGEDIT4 
 
[HKEY_LOCAL_MACHINE\Loader2]
; default string key
@="XML DOM Document"
; multi-line string key
"SystemPath"=hex(7):5c,00,50,00,53,00,4d,00,5c,00,00,00,00

[HKEY_LOCAL_MACHINE\Loader2]
; normal binary key
"SystemPath2"=hex:5c,50,53,4d,5c,00,00,00,00
; string key
"test"= "test"


For some reason they chose .ini instead of .reg for their registry file handling.

The file is from here: https://www.hpcfactor.com/scl/1142/Peica_Chen/RegImp/version_1.0 (along with the rest of the extremely sparse documentation)

What I'm typing is:
 
regimp /f:"\Hard Disk\sample.ini" /s


This got me the exact same result as without the parentheses--only "\Hard" is passed on to the program.
This was the only thing that worked:

regimp /f:sample.ini /s
(presuming that sample.ini exists at the root)




Edited by I dunk for bananas 2023-01-29 6:44 PM
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 6:38 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
Quote
torch - 2023-01-29 6:27 PM

Can you also upload your compilation here and when I have time I can try and replicate this for you?


Of course! Here it is:

It needs mfcce400.dll, let me know if you need it too!

Edited by I dunk for bananas 2023-01-29 6:39 PM




Attachments
----------------
Attachments regimp.exe (14KB - 1 downloads)
 Top of the page
C:Amie Page Icon Posted 2023-01-29 7:13 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,985
Location:
United Kingdom
Status:
So the import does work from the root? So the utility itself is working, it is just a non-root path issue?

If it doesn't:

;REGEDIT4 is wrong, it shouldn't have the ; in front of it.

I was also going to suggest deleting the comments.

Finally, I was going to suggest checking the file encoding. It should be unicorn really. You can try swapping the encoding and see what works.



On the path issue:
Is "Hard Disk" a symbolic link? If you create a folder \test\sample.ini does it work from there?

If you open command prompt and enter:
CD dir

What is printed?
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 8:13 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
Quote
So the import does work from the root? So the utility itself is working, it is just a non-root path issue?


This is true! It was working with the sample.ini file at least, so I'll have to make sure any registry files I try to import follow that exact format.
The problem is mostly the fact that it doesn't handle the space in the path appropriately, it doesn't matter if a file isn't at the root as long as it has no spaces in its path

Quote
If you create a folder \test\sample.ini does it work from there?


I tried it and regimp /f:test\sample.ini /s does indeed work! So the leading backslash definitely has to go.

Quote
Is "Hard Disk" a symbolic link?


It's just the name that CE gave my CF card, I wasn't aware the symbolic links are even a possibility in fat32/CE! The issue occurs with any path that has a space in it.

Quote
If you open command prompt and enter:
CD dir

What is printed?


(Assuming that by dir you mean a placeholder) it prints this:

\> cd Hard Disk 
\Hard Disk>
 Top of the page
C:Amie Page Icon Posted 2023-01-29 8:32 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,985
Location:
United Kingdom
Status:
Oh, apparently the forum parser nuked the commands I wrote:

cd dir 


So presumably
\my test\sample.ini doesn't work then?

CE can use a virtual file system, without knowing anything about how your ROM is structured or mounted, "hard disk" doesn't have to be a real FAT folder.
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 8:41 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:

Quote
So presumably
\my test\sample.ini doesn't work then?


Nope! It tries opening "\my"

Is there maybe a different way to unescape the space that the program will understand?
 Top of the page
C:Amie Page Icon Posted 2023-01-29 9:16 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,985
Location:
United Kingdom
Status:
Quotation marks are supposed to be the escape delimiter for spaces, but the dev must not have implemented standard args parsing. The only other DOS era trick was that a caret would escape a space e.g.

\Program Files\Microsoft
becomes
\Program^ Files\Microsoft

It is seldom used though.
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 9:19 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
The caret trick doesn't work either sadly, it tries opening "Hard^"
So I guess the workaround is going to have to be to make a script that copies the registry file to the root before running the utility I don't really trust myself to be able to go into the code and implement standard args parsing
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-29 9:57 PM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
I've written said script and it works fine!

C:Amie, copying a file from my CF to the root of the FS (which is in RAM) every time the system starts wouldn't cause much wear on the system, would it? Since we're just reading from the CF card
 Top of the page
C:Amie Page Icon Posted 2023-01-29 11:11 PM
#
Avatar image of C:Amie
Administrator
H/PC Oracle

Posts:
17,985
Location:
United Kingdom
Status:
Reading is zero penalty on NAND
 Top of the page
torch Page Icon Posted 2023-01-30 12:21 AM
#
Avatar image of torch
Subscribers
H/PC Guru

Posts:
5,731
Location:
United StatesĀ 
Status:
Is it safe for me to add this compiled exe to the SCL then?
 Top of the page
I dunk for bananas Page Icon Posted 2023-01-30 12:32 AM
#
Avatar image of I dunk for bananas
H/PC Elite

Posts:
702
Location:
Europe
Status:
Yes! I guess we'll just have to add the disclaimer that spaces in file names are not supported, and that leading backslashes must be omitted. And we should add the MFC DLL and documentation from the existing SCL entry (the .zip for arm, it has a "docs" folder I believe)
 Top of the page
1 2
Jump to forum:
Seconds to generate: 0.203 - Cached queries : 73 - Executed queries : 9