DC_Regquery on W10 64bit

This forum is for eXpress++ general support.
Message
Author
Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

DC_Regquery on W10 64bit

#1 Post 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 ?

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#2 Post 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 ;)

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#3 Post 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" ?

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Regquery on W10 64bit

#4 Post 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?
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Regquery on W10 64bit

#5 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Regquery on W10 64bit

#6 Post 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.
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#7 Post 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 :oops: 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,
Attachments
pdfset.zip
(9.33 KiB) Downloaded 694 times

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#8 Post 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...

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#9 Post 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.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: DC_Regquery on W10 64bit

#10 Post 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 :think:

Post Reply