Page 1 of 2
DC_Regquery on W10 64bit
Posted: Tue Jul 25, 2017 12:06 pm
by Victorio
Hi,
Why I can not read key from HKEY_LOCAL_MACHINE on W10 ?
Always return 2.
I tryed run application as admin, but any effect.
On W7 this works fine.
Here is syntax
verziapdfcreator2:=DC_Regquery(HKEY_LOCAL_MACHINE,"SOFTWARE\pdfforge\PDFCreator\Program","ApplicationVersion")
Is this some security problem ?
Re: DC_Regquery on W10 64bit
Posted: Tue Jul 25, 2017 12:53 pm
by Victorio
I mean, I found where can be problem. Maybe keys are 64bit.
When I try read key from registry from section Wow6432Node (for example Google\Update\version), DC_Regquery read this value good.
But in Wow6432Node is not PDF Creator
so in this moment I do not know what can I do, maybe need update DC_Regquery for read 32 and 64bit keys.
edit:
when try this direct from windows :
REG QUERY HKLM\SOFTWARE\pdfforge\PDFCreator\Program /v ApplicationVersion >fileinfo.txt
regkey save to file , and works also on Windows 10 64bit
this can be "primitive" to time,when found better solution

Re: DC_Regquery on W10 64bit
Posted: Tue Aug 01, 2017 1:20 am
by Victorio
similar problem with apply .reg file from application ...
problem is, that program must be run "as admin".
But I found solution with utility NIRCMD.EXE, with ELEVATE parameter, that run other program, module "as admin".
NIRCMD exist also 64bit version and works also with W10 64bit.
With use Runshell is Xbase command, is some way to run this also "as admin" ?
Re: DC_Regquery on W10 64bit
Posted: Tue Aug 01, 2017 9:10 am
by rdonnay
maybe need update DC_Regquery for read 32 and 64bit keys.
DC_RegQuery() uses the API calls RegOpenKeyExA() and RegQueryValueExA().
Are you saying that those calls should be changed for 64 bit systems?
Re: DC_Regquery on W10 64bit
Posted: Tue Aug 01, 2017 9:13 am
by rdonnay
REG QUERY HKLM\SOFTWARE\pdfforge\PDFCreator\Program /v ApplicationVersion >fileinfo.txt
That is very interesting.
I was not aware of the REG command.
I will look into this.
Re: DC_Regquery on W10 64bit
Posted: Tue Aug 01, 2017 9:30 am
by rdonnay
I suggest passing one of the below values as the 4th parameter to DC_RegQuery().
See the following link:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Code: Select all
Flag name Value Description
KEY_WOW64_64KEY 0x0100 Access a 64-bit key from either a 32-bit or 64-bit application.
KEY_WOW64_32KEY 0x0200 Access a 32-bit key from either a 32-bit or 64-bit application.
Re: DC_Regquery on W10 64bit
Posted: Tue Aug 01, 2017 1:45 pm
by Victorio
Roger,
ThankĀ“s for interesting info. I will look for this.
Now I still testing change registry keys for PDF Creator version 1.7.1 (for compatibility when users has this or newer version series 1.x. Works good on WXP,W7 32bit, tomorrow I will test on W10 64bit.
edit 2.8.2017 on Windows 10 64 works fine too, that mean, no need special read 64bit keys with REG command !.
In attached file is example, sorry, quit primitive algorithm, but works

I use 3 reg files and 1 bat file and also utility NIRCMDC.EXE for run bat file as admin.
(excuse me, comments are in Slovak language..)
I know, this is not good solution, better will be include all in application , maybe help your informations in last answer.
Now I want install PDF Creator 2.5.3 and include to application. In my source is not finish reading keys for this version, because here are not fixed name and position of registry keys,
Re: DC_Regquery on W10 64bit
Posted: Wed Aug 02, 2017 1:54 am
by Victorio
Note:
read and change reg keys for PDF Creator version 1.x works now after changes fine on all systems
W XP,W7, W10 64bit.
actually, I use NIRCMDC.EXE utility, no need his 64 bit version on W10 64bit.
Now I work on modify for new versions like 2.5.3, where reg keys are stored complicated...
Re: DC_Regquery on W10 64bit
Posted: Wed Aug 02, 2017 3:30 am
by Victorio
Hi Roger,
Please, tell me, how can I put this
Flag name Value Description
KEY_WOW64_64KEY 0x0100 Access a 64-bit key from either a 32-bit or 64-bit application.
KEY_WOW64_32KEY 0x0200 Access a 32-bit key from either a 32-bit or 64-bit application.
to DC_RegQuery ?
KEY_WOW... Xbase do not know,
0x0100 is hex values ?
KEY_WOW64_64KEY="0x0100" ? is not correct , or 0100, or need convert char to hex ?
KEY_WOW64_32KEY="0x0200" ?
a:=DC_Regquery(HKEY_LOCAL_MACHINE,"SOFTWARE\pdfforge\PDFCreator\Program","ApplicationVersion",KEY_WOW64_64KEY)
b:=DC_Regquery(HKEY_LOCAL_MACHINE,"SOFTWARE\pdfforge\PDFCreator\Program","ApplicationVersion",KEY_WOW64_32KEY)
edit :
with this :
#define KEY_WOW64_64KEY 0x0100
#define KEY_WOW64_32KEY 0x0200
works only on Win 7.
On Windows 10 64bit I cannot read key from HKEY_LOCAL_MACHINE, only drom HKEY_CURRENT_USER.
Now I do not know,if it is problem 32/64bit or problem with permisions other on W10 than W7.
Re: DC_Regquery on W10 64bit
Posted: Wed Aug 02, 2017 11:24 am
by Victorio
Maybe interesting information :
When I run this from batch file :
REG QUERY HKLM\SOFTWARE\pdfforge\PDFCreator /s >c:\##\zistenaverzia3
REG QUERY HKCU\SOFTWARE\pdfforge\PDFCreator /s >c:\##\zistenaverzia4
on W7 32 bit, this create complete files with keys
on W10 64 bit normal create only group HKCU, but nothing for HKLM
when run "as administrator" (no login as administrator, only "run as..." this works also for HKLM
Question for Roger, or anyone :
When I use DC_RegQuery from my application, and application I start "as admin", DC_Regquery not run as admin ? Everything looks for this, because DC_RegQuery not read HKLM keys on W10 64bit.
Is some way to force run DC_RegQuery or RegQueryValueExA() also "as admin" ?
Now I do not know any solution, only run "REG QUERY ... from NIRCMDC.EXE utility via Runshell, generate file, where was report registry keys, then analyze it and again run REG EDIT from NIRCMDC
Sorry for repeating the same problem
