Invalid key name - windows

In a quick and dirty backup script that's been running fine for years, the registry backup part no longer works. I run the offending code in the command line and get the same result:
C:\>reg export /y HKLM\SOFTWARE\ODBC\ODBC.INI test.reg
ERROR: nombre de clave no válido.
Escriba "REG EXPORT /?" para obtener detalles de uso.
Error translates as "invalid key name". If I lauch regedit and copy the key name to clipboard I get this:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
If there is a typo, I'm unable to spot it.
Am I really mistyping the key name? Is there any other reason for the error?

Documentation says this:
Reg export KeyName FileName [/y]
In other words, flags come last:
C:\>reg export HKLM\SOFTWARE\ODBC\ODBC.INI test.reg /y
La operación se ha completado correctamente.
No idea why it's been working before.

Related

'C:\Program' is not recognized as an internal or external command in 'Git Bash Here' terminal - Windows (salesforce sfdx) - SOLVE

I'm here to ask you a very strange problem.
Right now i'm starting to work on Salesforce technology, in windows, and currently i follow the tutorial. When finally arrive to the terminal part, Windows come out to create problem...
I state that I am using the terminal of Git Bash Here (MinTTY)
$ sfdx force:data:record:create -s Account -v "Name='Hilton Union Square' BillingStreet='333 O Farrell St' BillingCity='San Francisco' BillingState='CA' BillingPostalCode='94102' Phone='(415) 771-1400' Website='www.hilton.com'"
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
More in general, the problem comes out every time there are Quote in the argument:
$ sfdx ""
"C:\Program" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
opposite to:
$ sfdx
Salesforce CLI
VERSION
sfdx-cli/7.157.0 win32-x64 node-v16.15.1
USAGE
$ sfdx [COMMAND]
TOPICS
alias manage username aliases
auth authorize an org for use with the Salesforce CLI
config configure the Salesforce CLI
......
I try almost every thing: alias, Path, Full Path, Short Path, Quote, ...
this is my current path:
PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/A409806/bin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/WindowsPowerShell/Scripts:/cmd:/c/Program Files/nodejs:/c/Users/A409806/AppData/Local/Microsoft/WindowsApps:/c/Program Files/sfdx/bin:/c/Users/A409806/AppData/Roaming/npm:/c/Users/A409806/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/A409806/AppData/Local/JetBrains/Toolbox/scripts:/usr/bin/vendor_perl:/usr/bin/core_perl
Please, someone help me, i suppose is MinTTY problem, but i can't immage how solve it.
Thanks agane
UPDATE
I expose same problem and find de solution here:
Solution

Codesign an executable and allow the modification of some bytes

I use signtool.exe to codesign a Windows executable.
Which options of this tool can be used to define that a few bytes should be omitted from the hash calculation, and thus allowing that a digitally signed executable can have 8 or 16 bytes modified later?
This technique has been used by Mozilla (their .exe installer is different for each download, but has the same digital signature), see How can a .exe be modified and still keep a valid digital signature?.
The WinAPI function ImageGetDigestStream has an option DigestLevel to exclude resource information from the hash computation, but how to use this option when actually with signtool.exe or a similar tool?
This is explained by Didier Stevens in an article here: It's in the signature and he also provides a tool "disitool" to manipulate the signature.
Here are the steps to sign a file using Authenticode, and to append some data to it without breaking the signature:
A) Create a code siging certificate (you'll be required to enter passwords):
MakeCert /n "CN=MyOrg" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /sv MyOrg.pvk MyOrg.cer
note: 1.3.6.1.5.5.7.3.3 is szOID_PKIX_KP_CODE_SIGNING and 1.3.6.1.4.1.311.10.3.13 is szOID_KP_LIFETIME_SIGNING. This will create a private key file and a certificate file.
B) Add certificate to store (needs admin rights, could be a different store):
Certutil -addStore TrustedPeople MyOrg.cer
C) Create a Pfx file to sign:
Pvk2Pfx /pvk MyOrg.pvk /pi [Password goes here] /spc MyOrg.cer /pfx MyOrg.pfx
D) Sign your file:
SignTool.exe sign /fd SHA256 /v /a /f MyOrg.pfx /p [Password goes here] MyFile.exe
At this point MyFile.exe is signed using Authenticode:
E) Create some data.txt file. I've created one that just contains the "[Kilroy was here!]" text.
F) Now run disitool:
python.exe disitool.py inject --paddata MyFile.exe data.txt MyFile2.exe
And here is the result, MyFile2.exe is still valid without resigning the file:
While you can see data.txt's content added to its end:
From the original file's end:

Apache prunsrv: error parsing command line

I'm trying to start a Java program as a Windows Service. Googling I've found a install.bat to install and start my service.
As I found on the Internet, I've renamed prunsrv.exe to IdentificationService.exe.
D:\IdentificationService\bin\IdentificationService.exe //IS//IdentificationService
D:\IdentificationService\bin\IdentificationService.exe //US//IdentificationService --Install=D:\IdentificationService\bin\IdentificationService.exe --Description= Identification Service --Jvm="C:\Program Files (x86)\\Diginet\java\bin\server\jvm.dll" --Classpath=D:\IdentificationService\lib --StartMode=jvm --StartClass=br.com..digis.DiginetIdentificationService --StartMethod=start --StartParams=start --StopMode=jvm --StopClass=br.com..digis.DiginetIdentificationService --StopMethod=stop --StopParams=stop --LogPath=D:\IdentificationService\logs --StdOutput=auto --StdError=auto
net start IdentificationService
My problem is that each time I execute IdentificationService it says "Error parsing command line".
I've tried to enclose all parameters by double quotes. Same results.
I've tried to use the original prunsrv.exe withou renaming it. Same results.
What am I missing?
Try setting the parameters through the environment variables
set SERVICE_NAME=CsvToXmlService
set PR_INSTALL=%cd%\prunsrv.exe
set PR_DESCRIPTION=CsvToXml Service
REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=%cd%
set PR_STDOUTPUT=%cd%\stdout.txt
set PR_STDERROR=%cd%\stderr.txt
set PR_LOGLEVEL=Error
REM Path to java installation
set PR_JVM=C:\Program Files\Java\jre7\bin\server\jvm.dll
set PR_CLASSPATH=%cd%\target\app.jar
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=ru.misterparser.csvtoxmlservice.Main
set PR_STARTMETHOD=start
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=ru.misterparser.csvtoxmlservice.Main
set PR_STOPMETHOD=stop
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
set PR_JVMOPTIONS=-Duser.language=RU;-Duser.region=ru
REM Install service
prunsrv.exe //IS//%SERVICE_NAME%
sc start %SERVICE_NAME%
rename exe back to prunsrv and run it with exactly same parameters (except first exe ofc)

Remove usb drive using cli, on success remove turn off the windows

I wondering to make a batch file that have purposed like this :
when a usb drive that ejected on my notebook is succesfully unmount, I want to make my windows is shutdown.
So, I use RemoveDrive.
Assumed, I mounted my flash drive to E, I use this command
RemoveDrive.exe E: -L
it gives me message like this :
Removing 'My drive'(E:)
success
Now, I was wondering to make a batch file (.bat), when success, it execute 'shutdown / s'. if failed, it gives me just a message error. How come ?
Amy help it so appreciated.
Edit :
based this web : FAQ
it said :
0 - successfully removed a device
1 - device identified but not removed
2 - device not found or parameters are invalid
4 - RemoveDrive.exe located on the drive to remove -> temporary copy
created and executed
so this is my code so far :
#ECHO OFF
set def="0"
SET /P uname=Enter the drive (letter:):
IF "%uname%"=="" GOTO Error
RemoveDrive.exe "%uname%" -L
if %ERRORLEVEL% == def
shutdwon /s
else
echo 'Something have problem'
GOTO End
:Error
ECHO Please enter your drive's name!
:End
if success or failed, it still gives me the syntax of command is inicnorrect message
As per if command syntax and explanation in Command-Line Reference:
if %ERRORLEVEL% == def (
shutdown /s
) else (
echo 'Something have problem'
)

VBS - Error opening connection using ADODB

I'm having problems trying to connect in my oracle database using an ADODB object in VBScript, the code is working on a Win7 machine but not on WinXP, I tried to search for the error code, downloaded the sdk with the help file to look for something but I didn't found nothing useful.
Here is the code sample:
ConnectionString = "DSN=(Oracle in OraClient11g_home1);UID=username ;PWD=password ;DBQ=myDatabase"
Set objCon = CreateObject("ADODB.Connection")
objCon.Open ConnectionString 'the error occurs in this line
I don't know if the connection string must be different for winXP machines... I really don't know how to solve this, can someone help me?
The error trace information:
"Error #-2147024770:
Error reported by: ADODB.Connection
Help File:
Topic ID: 1240640"
-2147024770 = FFFFFFFF8007007E
To Decode 0x8007nnnn Errors
HResults with facility code 7 means the HResult contains a Windows' error code. You have to look up the Windows' error code not the HResult.
To decode 0x8007007e. The 0x means it's a hexadecimal number, the 8 means error, the first 7 means it a windows error, and the rest of the number, 7e, is the actual Windows error.
To look up the error we need it in decimal format. Start Calculator (Start - All Programs - Accessories - Calculator) and choose View menu - Scientific, then View menu - Hex. Enter 7e. Then View menu - Decimal. It will say 126.
Start a Command Prompt (Start - All Programs - Accessories - Command Prompt) and type
net helpmsg 126
and it will say
The specified module could not be found.
or look it up in winerror.h
//
// MessageId: ERROR_MOD_NOT_FOUND
//
// MessageText:
//
// The specified module could not be found.
//
#define ERROR_MOD_NOT_FOUND 126L
To see what is happening start your program in ntsd.
Start a command prompt.
Type
md c:\symbols
set _NT_SYMBOL_PATH=srv*C:\tmp*http://msdl.microsoft.com/download/symbols;c:\symbols
then (changing it to your program from notepad)
ntsd -g -o c:\windows\notepad.exe
so something
ntsd -g -o wscript "c:\folder\script.vbs"
and wait for the error.

Resources