Reading registry content from a COM DLL 
Author Message
 Reading registry content from a COM DLL

Hi All,

while developing a DLL ,I want to get a file path. for that i'm
reading it from a registry. It is a COM Dll. will it create any
problem for reading a registry content from a COM DLL? Is it allowed
to read Registry content from a COM DLL?
if not, is there any other method to do so? please reply to this..
here is the code...

                if( RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)(REGPATH),0,KEY_QUERY_VALUE,&hKeyChild)
!= ERROR_SUCCESS)
                {
                        return NULL;
                }

                if( RegQueryValueEx(
hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
ERROR_SUCCESS )
                {

                        return NULL;
                }
Thanks in advance

--Anoop



Fri, 25 Feb 2005 16:54:29 GMT  
 Reading registry content from a COM DLL
You can read from registry in your DLL. You can use CRegKey, and there you
will find a sample.

Regards,
Mike

Quote:
> Hi All,

> while developing a DLL ,I want to get a file path. for that i'm
> reading it from a registry. It is a COM Dll. will it create any
> problem for reading a registry content from a COM DLL? Is it allowed
> to read Registry content from a COM DLL?
> if not, is there any other method to do so? please reply to this..
> here is the code...

> if(

RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)(REGPATH),0,KEY_QUERY_VALUE,&hKeyCh
ild)
Quote:
> != ERROR_SUCCESS)
> {
> return NULL;
> }

> if( RegQueryValueEx(
> hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
> ERROR_SUCCESS )
> {

> return NULL;
> }
> Thanks in advance

> --Anoop



Fri, 25 Feb 2005 19:56:01 GMT  
 Reading registry content from a COM DLL
Thanq Mike.
will it create any problem if it is a COM DLL?
regards
--Anoop
Quote:

> You can read from registry in your DLL. You can use CRegKey, and there you
> will find a sample.

> Regards,
> Mike


> > Hi All,

> > while developing a DLL ,I want to get a file path. for that i'm
> > reading it from a registry. It is a COM Dll. will it create any
> > problem for reading a registry content from a COM DLL? Is it allowed
> > to read Registry content from a COM DLL?
> > if not, is there any other method to do so? please reply to this..
> > here is the code...

> > if(
> RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)(REGPATH),0,KEY_QUERY_VALUE,&hKeyCh
> ild)
> > != ERROR_SUCCESS)
> > {
> > return NULL;
> > }

> > if( RegQueryValueEx(
> > hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
> > ERROR_SUCCESS )
> > {

> > return NULL;
> > }
> > Thanks in advance

> > --Anoop



Sun, 27 Feb 2005 14:15:24 GMT  
 Reading registry content from a COM DLL
Nope.

Regards,
Mike

Quote:
> Thanq Mike.
> will it create any problem if it is a COM DLL?
> regards
> --Anoop




Quote:
> > You can read from registry in your DLL. You can use CRegKey, and there
you
> > will find a sample.

> > Regards,
> > Mike


> > > Hi All,

> > > while developing a DLL ,I want to get a file path. for that i'm
> > > reading it from a registry. It is a COM Dll. will it create any
> > > problem for reading a registry content from a COM DLL? Is it allowed
> > > to read Registry content from a COM DLL?
> > > if not, is there any other method to do so? please reply to this..
> > > here is the code...

> > > if(

RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)(REGPATH),0,KEY_QUERY_VALUE,&hKeyCh

- Show quoted text -

Quote:
> > ild)
> > > != ERROR_SUCCESS)
> > > {
> > > return NULL;
> > > }

> > > if( RegQueryValueEx(
> > > hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
> > > ERROR_SUCCESS )
> > > {

> > > return NULL;
> > > }
> > > Thanks in advance

> > > --Anoop



Sun, 27 Feb 2005 19:04:07 GMT  
 Reading registry content from a COM DLL
The fact your code is packaged in a DLL, COM or regular, doesn't
matter. What matters is the execution context. Almost always
you have read access to any branch of the registry. If you execute
under the LocalSystem account, you have no access to HKCU. If
you execute as a regular user, you have no write access to any
branch except for HKCU. No security is enforced under Win9x.
Again, note that these security implications have nothing to do
with the DLL your code resides in and are determined by the
executable that loads it.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> Thanq Mike.
> will it create any problem if it is a COM DLL?
> regards
> --Anoop


> > You can read from registry in your DLL. You can use CRegKey, and there you
> > will find a sample.

> > Regards,
> > Mike


> > > Hi All,

> > > while developing a DLL ,I want to get a file path. for that i'm
> > > reading it from a registry. It is a COM Dll. will it create any
> > > problem for reading a registry content from a COM DLL? Is it allowed
> > > to read Registry content from a COM DLL?
> > > if not, is there any other method to do so? please reply to this..
> > > here is the code...

> > > if(
> > RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)(REGPATH),0,KEY_QUERY_VALUE,&hKeyCh
> > ild)
> > > != ERROR_SUCCESS)
> > > {
> > > return NULL;
> > > }

> > > if( RegQueryValueEx(
> > > hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
> > > ERROR_SUCCESS )
> > > {

> > > return NULL;
> > > }
> > > Thanks in advance

> > > --Anoop



Mon, 28 Feb 2005 01:42:56 GMT  
 Reading registry content from a COM DLL
Thank you all for your valuable replies :)
regards
-Anoop
Quote:

> The fact your code is packaged in a DLL, COM or regular, doesn't
> matter. What matters is the execution context. Almost always
> you have read access to any branch of the registry. If you execute
> under the LocalSystem account, you have no access to HKCU. If
> you execute as a regular user, you have no write access to any
> branch except for HKCU. No security is enforced under Win9x.
> Again, note that these security implications have nothing to do
> with the DLL your code resides in and are determined by the
> executable that loads it.

> --
> =========================
> ============
> Alexander Nickolov
> Microsoft MVP [VC], MCSD

> MVP VC FAQ: http://www.mvps.org/vcfaq
> =========================
> ============



> > Thanq Mike.
> > will it create any problem if it is a COM DLL?
> > regards
> > --Anoop



> > > You can read from registry in your DLL. You can use CRegKey, and
>  there you
> > > will find a sample.

> > > Regards,
> > > Mike


> > > > Hi All,

> > > > while developing a DLL ,I want to get a file path. for that i'm
> > > > reading it from a registry. It is a COM Dll. will it create any
> > > > problem for reading a registry content from a COM DLL? Is it
>  allowed
> > > > to read Registry content from a COM DLL?
> > > > if not, is there any other method to do so? please reply to this..
> > > > here is the code...

> > > > if(

> RegOpenKeyEx(HKEY LOCAL MACHINE,(LPCTSTR)(REGPATH),0,KEY QUERY VALUE,&hKe
> yCh
> > > ild)
> > > > != ERROR SUCCESS)
> > > > {
> > > > return NULL;
> > > > }

> > > > if( RegQueryValueEx(
> > > > hKeyChild,(LPCTSTR)REGNAME,NULL,NULL,(LPBYTE)&pathname,&size) !=
> > > > ERROR SUCCESS )
> > > > {

> > > > return NULL;
> > > > }
> > > > Thanks in advance

> > > > --Anoop



Mon, 28 Feb 2005 11:41:29 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. reading registry from COM

2. call a VB COM dll thru a C++ COM dll from a C program

3. call a VB COM dll thru a C++ COM dll from a C program

4. Content of the registry

5. Reading BIOS CMOS content...

6. read a directory content

7. Reading the contents of URL using C Language.

8. Reading contents of memory....

9. reading text file contents into 2D array

10. hi, need help trying to read contents of a CDROM

11. Reading the contents of an ADO Recordset prior to data binding

12. Another easy question: reading the contents of a file into a string

 

 
Powered by phpBB® Forum Software