D - registry
- Carlos Santander B. (18/18) Mar 27 2003 Hi,
- Jon Allen (9/27) Mar 27 2003 HKEY_LOCAL_MACHINE should be declared as an HKEY, and HANDLE should be a
-
Carlos Santander B.
(14/14)
Mar 27 2003
"Jon Allen"
escribiσ en el mensaje -
Carlos Santander B.
(36/36)
Mar 27 2003
"Carlos Santander B."
escribiσ en el mensaje - Jon Allen (13/49) Mar 27 2003 the windows.d i have does it like this:
-
Carlos Santander B.
(22/22)
Mar 27 2003
"Jon Allen"
escribiσ en el mensaje -
Carlos Santander B.
(23/23)
Mar 27 2003
"Jon Allen"
escribiσ en el mensaje -
Carlos Santander B.
(38/38)
Mar 27 2003
"Carlos Santander B."
escribiσ en el mensaje - Jon Allen (8/20) Mar 27 2003 Heh, go figure. Why is it always the simplest possible problem that is
- Matthew Wilson (8/28) Mar 27 2003 void * is the same size as int. Both 32-bits. You're kind of tunnelling
- Jon Allen (9/45) Mar 28 2003 Do you know whether exported finction in libs (or dll's for that matter)
- Matthew Wilson (12/60) Mar 28 2003 They don't. While this can be an opportunity for errors, it does also
- Burton Radons (4/8) Mar 28 2003 The D calling convention has type information in the signatures so they
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
Mar 27 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 isanint. But I want to open HKEY_LOCAL_MACHINE, which value is 0x80000002,thatis an uint. I tried to declare RegOpenKeyA() in windows.d to receive an uint, but the linker complained (I think that's pretty obvious). WhatshouldI do? What I'm trying to do is to get the processor's description. I know I candoit 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
Mar 27 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
Mar 27 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
Mar 27 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 bea| | 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 bea| | 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
Mar 27 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
Mar 27 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
Mar 27 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
Mar 27 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 allthoseweird 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?
Mar 27 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...(sinceOf 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 allthoseweird 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 declareasit's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY) ornot,(int,LPCSTR,PHKEY). why? are void* and int the same? (I know they'rebut 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?
Mar 27 2003
Do you know whether exported finction in libs (or dll's for that matter) contain any type information besides just sizes? It seems like they should but it also seems like they don't. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b60upk$7p5$1 digitaldaemon.com...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...oldOf 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 reallyor(sincePavel's windows.d (more complete, though), and there's where I had allthoseweird 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 declareit's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY)asThatnot,(int,LPCSTR,PHKEY). why? are void* and int the same? (I know they'rebut 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?anddoesn't seem right though. On a completely unrelated note. Why does Microsoft have to put replyreply to group right next to eachother?
Mar 28 2003
They don't. While this can be an opportunity for errors, it does also to C DLL functions. By declaring the function signatures with differing, but known (by me!) to be benignly equivalent, types, I can avoid a whole load of but used judiciously it can be a nice thing. "Jon Allen" <jallen minotstateu.edu> wrote in message news:b6162e$de2$1 digitaldaemon.com...Do you know whether exported finction in libs (or dll's for that matter) contain any type information besides just sizes? It seems like theyshouldbut it also seems like they don't. "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b60upk$7p5$1 digitaldaemon.com...allvoid * 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...oldOf 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 reallyPavel's windows.d (more complete, though), and there's where I hadisthoseweird declarations. my God!!!!!!!!!! how can a human being be sooooooooooooooo stupid?Heh, go figure. Why is it always the simplest possible problem thatbothoralways the hardest to figure out?(sinceBy the way, dmd compiles (and links) my file just fine if I declareit's not in Walter's windows.d) RegOpenKeyA as (void *,LPCSTR,PHKEY)asnot,(int,LPCSTR,PHKEY). why? are void* and int the same? (I know they'rebut still....)ummm...Good question. They're both the same size. Maybe they justThatshow up as double words in the lib files rather than specific types?anddoesn't seem right though. On a completely unrelated note. Why does Microsoft have to put replyreply to group right next to eachother?
Mar 28 2003
Carlos Santander B. wrote: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....)The D calling convention has type information in the signatures so they can be differentiated, but the Windows calling convention has the stack size only, which is what the 12 at the end is indicating.
Mar 28 2003