Jump to page: 1 2
Thread overview
registry
Mar 28, 2003
Jon Allen
Mar 28, 2003
Jon Allen
Mar 28, 2003
Jon Allen
Mar 28, 2003
Matthew Wilson
Mar 28, 2003
Jon Allen
Mar 28, 2003
Matthew Wilson
Mar 28, 2003
Burton Radons
March 27, 2003
Hi,
I'm trying to access the Windows Registry, so I'm using RegOpenKeyA(). The
thing is that this function receives an HKEY, which is a HANDLE, which is an
int. But I want to open HKEY_LOCAL_MACHINE, which value is 0x80000002, that
is an uint. I tried to declare RegOpenKeyA() in windows.d to receive an
uint, but the linker complained (I think that's pretty obvious). What should
I do?
What I'm trying to do is to get the processor's description. I know I can do
it calling the Win32 API, but if I use the registry I don't need to parse
the information I get. Besides, later I need to get the list of installed
programs, which is also in the registry. So it seems like I don't have a
choice. Any ideas?


-------------------------
Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25


March 28, 2003
HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be a void*

You should check to make sure your windows.d is up to date.

"Carlos Santander B." <carlos8294@msn.com> wrote in message news:b5vs1h$2eq3$1@digitaldaemon.com...
> Hi,
> I'm trying to access the Windows Registry, so I'm using RegOpenKeyA(). The
> thing is that this function receives an HKEY, which is a HANDLE, which is
an
> int. But I want to open HKEY_LOCAL_MACHINE, which value is 0x80000002,
that
> is an uint. I tried to declare RegOpenKeyA() in windows.d to receive an
> uint, but the linker complained (I think that's pretty obvious). What
should
> I do?
> What I'm trying to do is to get the processor's description. I know I can
do
> it calling the Win32 API, but if I use the registry I don't need to parse the information I get. Besides, later I need to get the list of installed programs, which is also in the registry. So it seems like I don't have a choice. Any ideas?
>
>
> -------------------------
> Carlos Santander
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25
>
>


March 28, 2003
"Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
news:b607au$2o9g$1@digitaldaemon.com...
| HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be a
| void*
|
| You should check to make sure your windows.d is up to date.
|

Well, HKEY_LOCAL_MACHINE is an HKEY, which is a HANDLE, which is an int.

————————————————————————— Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-25


March 28, 2003
"Carlos Santander B." <carlos8294@msn.com> escribió en el mensaje
news:b60jc0$30ob$1@digitaldaemon.com...
| "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
| news:b607au$2o9g$1@digitaldaemon.com...
| | HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be a
| | void*
| |
| | You should check to make sure your windows.d is up to date.
| |
|
| Well, HKEY_LOCAL_MACHINE is an HKEY, which is a HANDLE, which is an int.
|
|

My mistake. In order to compile windows.d, I had to declare HKEY_LOCAL_MACHINE as an uint, because otherwise it wouldn't compile. And not only HKEY_LOCAL_MACHINE: a lot of other const's too...

—————————————————————————
Carlos Santander
"Carlos Santander B." <carlos8294@msn.com> escribió en el mensaje
news:b60jc0$30ob$1@digitaldaemon.com...
| "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
| news:b607au$2o9g$1@digitaldaemon.com...
| | HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be a
| | void*
| |
| | You should check to make sure your windows.d is up to date.
| |
|
| Well, HKEY_LOCAL_MACHINE is an HKEY, which is a HANDLE, which is an int.
|
|

My mistake. In order to compile windows.d, I had to declare HKEY_LOCAL_MACHINE as an uint, because otherwise it wouldn't compile. And not only HKEY_LOCAL_MACHINE: a lot of other const's too...

————————————————————————— Carlos Santander


March 28, 2003
the windows.d i have does it like this:

enum : HKEY
{
    //stuff
    HKEY_LOCAL_MACHINE=((HKEY)0x80000002)
    //stuff
}

i bet this would work too though:

const HKEY HKEY_LOCAL_MACHINE=cast(HKEY)0x80000002;

"Carlos Santander B." <carlos8294@msn.com> wrote in message news:b60joi$311f$1@digitaldaemon.com...
> "Carlos Santander B." <carlos8294@msn.com> escribió en el mensaje
> news:b60jc0$30ob$1@digitaldaemon.com...
> | "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
> | news:b607au$2o9g$1@digitaldaemon.com...
> | | HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be
a
> | | void*
> | |
> | | You should check to make sure your windows.d is up to date.
> | |
> |
> | Well, HKEY_LOCAL_MACHINE is an HKEY, which is a HANDLE, which is an int.
> |
> |
>
> My mistake. In order to compile windows.d, I had to declare HKEY_LOCAL_MACHINE as an uint, because otherwise it wouldn't compile. And not only HKEY_LOCAL_MACHINE: a lot of other const's too...
>
> -------------------------
> Carlos Santander
> "Carlos Santander B." <carlos8294@msn.com> escribió en el mensaje
> news:b60jc0$30ob$1@digitaldaemon.com...
> | "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
> | news:b607au$2o9g$1@digitaldaemon.com...
> | | HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be
a
> | | void*
> | |
> | | You should check to make sure your windows.d is up to date.
> | |
> |
> | Well, HKEY_LOCAL_MACHINE is an HKEY, which is a HANDLE, which is an int.
> |
> |
>
> My mistake. In order to compile windows.d, I had to declare HKEY_LOCAL_MACHINE as an uint, because otherwise it wouldn't compile. And not only HKEY_LOCAL_MACHINE: a lot of other const's too...
>
> -------------------------
> Carlos Santander
>
>


March 28, 2003
"Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
news:b60kt4$ff$1@digitaldaemon.com...
| the windows.d i have does it like this:
|
| enum : HKEY
| {
|     //stuff
|     HKEY_LOCAL_MACHINE=((HKEY)0x80000002)
|     //stuff
| }
|
| i bet this would work too though:
|
| const HKEY HKEY_LOCAL_MACHINE=cast(HKEY)0x80000002;
|

Thanks, I'll check it out.

————————————————————————— Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-26


March 28, 2003
"Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
news:b60kt4$ff$1@digitaldaemon.com...
| the windows.d i have does it like this:
|
| enum : HKEY
| {
|     //stuff
|     HKEY_LOCAL_MACHINE=((HKEY)0x80000002)
|     //stuff
| }
|
| i bet this would work too though:
|
| const HKEY HKEY_LOCAL_MACHINE=cast(HKEY)0x80000002;
|

Well, doesn't work either. I still get: Error 42: Symbol Undefined _RegOpenKeyA@12.

————————————————————————— Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-26


March 28, 2003
"Carlos Santander B." <carlos8294@msn.com> escribió en el mensaje
news:b60lsv$1dj$1@digitaldaemon.com...
| "Jon Allen" <jallen@minotstateu.edu> escribió en el mensaje
| news:b60kt4$ff$1@digitaldaemon.com...
| | the windows.d i have does it like this:
| |
| | enum : HKEY
| | {
| |     //stuff
| |     HKEY_LOCAL_MACHINE=((HKEY)0x80000002)
| |     //stuff
| | }
| |
| | i bet this would work too though:
| |
| | const HKEY HKEY_LOCAL_MACHINE=cast(HKEY)0x80000002;
| |
|
| Well, doesn't work either. I still get: Error 42: Symbol Undefined
| _RegOpenKeyA@12.

Of course!!!!!!!!!!!!!!!!!!!!!!!!! I had no idea it needed
advapi32.lib....................
I'm gonna shoot myself!!!!!!!!!!!
(well, not so much)
also, for some reason, besides src\phobos\windows.d, I have a really old
Pavel's windows.d (more complete, though), and there's where I had all those
weird declarations.
my God!!!!!!!!!! how can a human being be sooooooooooooooo stupid?
By the way, dmd compiles (and links) my file just fine if I declare (since
it's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY) or as
(int,LPCSTR,PHKEY). why? are void* and int the same? (I know they're not,
but still....)

————————————————————————— Carlos Santander


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 2003-03-26


March 28, 2003
> Of course!!!!!!!!!!!!!!!!!!!!!!!!! I had no idea it needed
> advapi32.lib....................
> I'm gonna shoot myself!!!!!!!!!!!
> (well, not so much)
> also, for some reason, besides src\phobos\windows.d, I have a really old
> Pavel's windows.d (more complete, though), and there's where I had all
those
> weird declarations.
> my God!!!!!!!!!! how can a human being be sooooooooooooooo stupid?

Heh, go figure.  Why is it always the simplest possible problem that is always the hardest to figure out?

> By the way, dmd compiles (and links) my file just fine if I declare (since
> it's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY) or as
> (int,LPCSTR,PHKEY). why? are void* and int the same? (I know they're not,
> but still....)

ummm...Good question.  They're both the same size.  Maybe they just both show up as double words in the lib files rather than specific types?  That doesn't seem right though.


On a completely unrelated note.  Why does Microsoft have to put reply and reply to group right next to eachother?



March 28, 2003
void * is the same size as int. Both 32-bits. You're kind of tunnelling through the type system, and it works because of the same size. To a processor, there is no difference between void* and int32

"Jon Allen" <jallen@minotstateu.edu> wrote in message news:b60nlr$2jb$1@digitaldaemon.com...
> > Of course!!!!!!!!!!!!!!!!!!!!!!!!! I had no idea it needed
> > advapi32.lib....................
> > I'm gonna shoot myself!!!!!!!!!!!
> > (well, not so much)
> > also, for some reason, besides src\phobos\windows.d, I have a really old
> > Pavel's windows.d (more complete, though), and there's where I had all
> those
> > weird declarations.
> > my God!!!!!!!!!! how can a human being be sooooooooooooooo stupid?
>
> Heh, go figure.  Why is it always the simplest possible problem that is always the hardest to figure out?
>
> > By the way, dmd compiles (and links) my file just fine if I declare
(since
> > it's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY) or
as
> > (int,LPCSTR,PHKEY). why? are void* and int the same? (I know they're
not,
> > but still....)
>
> ummm...Good question.  They're both the same size.  Maybe they just both show up as double words in the lib files rather than specific types?  That doesn't seem right though.
>
>
> On a completely unrelated note.  Why does Microsoft have to put reply and reply to group right next to eachother?
>
>
>


« First   ‹ Prev
1 2