|
-
Jan 24th, 2006, 08:11 AM
#1
Thread Starter
Hyperactive Member
Clsid
How do I find out what the CLSID is going to be for my DLL when I register it?
The DLL project name is "eth0" and the DLL class name is "CShellExt". I compiled and registered it, searched the registry for "eth0.CShellExt" and found it under the key "{5BFAC3A1-8B25-44E0-8A38-0FA0980A5355}" so I made the following .reg file
Code:
REGEDIT4
[HKEY_CLASSES_ROOT\jpegfile\shellex\ContextMenuHandlers\eth0]
@="{5BFAC3A1-8B25-44E0-8A38-0FA0980A5355}"
[HKEY_CLASSES_ROOT\giffile\shellex\ContextMenuHandlers\eth0]
@="{5BFAC3A1-8B25-44E0-8A38-0FA0980A5355}"
[HKEY_CLASSES_ROOT\pngfile\shellex\ContextMenuHandlers\eth0]
@="{5BFAC3A1-8B25-44E0-8A38-0FA0980A5355}"
But it does not seem to be working. How would I check that I am using the correct CLSID?
-
Jan 24th, 2006, 01:00 PM
#2
Re: Clsid
What are you using the clsid for?
-
Jan 26th, 2006, 08:00 PM
#3
Thread Starter
Hyperactive Member
Re: Clsid
For adding a context menu to the right click on images.
The non-working setup is on eth0.org, its just a winrar sfx that installs the dll and some exes to c:\windows\eth0\ the dll handels the selected images when you right click on them and select one of my added options, then the dll calls the exe to upload them.
-
Feb 1st, 2006, 01:01 PM
#4
Lively Member
Re: Clsid
CLSID is a struct: {DWORD, WORD, WORD, BYTE[8]}
for C your CLSID is
const CLSID clsidID = {0x5BFAC3A1, 0x8B25, 0x44E0, {0x8A, 0x38, 0x0F, 0xA0, 0x98, 0x0A, 0x53, 0x55}};
"bla, bla,... exists number M so for each n > M bla, bla..." Exists? Where is it? (Kronecker said...)
-
Feb 5th, 2006, 10:00 PM
#5
Thread Starter
Hyperactive Member
Re: Clsid
What about for a VB ActiveX DLL?
-
Feb 9th, 2006, 07:54 AM
#6
Thread Starter
Hyperactive Member
Re: Clsid
So no one knows how to find the CLSID that a dll is going to be assigned when its registered?
-
Feb 11th, 2006, 02:39 PM
#7
Lively Member
Re: Clsid
A dll, ocx,... may have more than one COM object and so more than one CLSID. If you want to find which CLSIDs a library registers you must search the registry. The following code searches for CLSIDs registered by comctl32.ocx.
Code:
#include <windows.h>
#include <string.h>
void SearchRegistry()
{
LONG lr = ERROR_SUCCESS;
HKEY hKey = NULL;
HKEY hEnumKey = NULL;
HKEY hIpsKey = NULL;
DWORD dwIndex = 0;
char szClsidName[0xff];
char szDLLName[0xff];
char szProgID[0xff];
char * szSearchStr = "C:\\WINDOWS\\SYSTEM32\\COMCTL32.OCX";
DWORD dwCount = 0xff;
LONG lcnt = 0;
lr = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &hKey);
while (lr = RegEnumKeyA(hKey, dwIndex++, szClsidName, dwCount) == ERROR_SUCCESS)
{
lr = RegOpenKeyExA(hKey, szClsidName, 0, KEY_READ, &hEnumKey);
lr = RegOpenKeyExA(hEnumKey, "InprocServer32", 0, KEY_READ, &hIpsKey);
lr = RegQueryValueA(hIpsKey, NULL, szDLLName, &lcnt);
if (lr == ERROR_SUCCESS)
{
_strupr(szDLLName);
if (strcmp(szSearchStr, szDLLName) == 0)
{
printf("CLSID: %s\n", szClsidName);
RegCloseKey(hIpsKey);
lr = RegOpenKeyExA(hEnumKey, "ProgID", 0, KEY_READ, &hIpsKey);
lr = RegQueryValueA(hIpsKey, NULL, szProgID, &lcnt);
if (lr == ERROR_SUCCESS)
printf("ProgID: %s\n\n", szProgID);
else
printf("ProgID: not found\n\n");
}
}
RegCloseKey(hIpsKey);
RegCloseKey(hEnumKey);
}
RegCloseKey(hKey);
}
int main()
{
SearchRegistry();
return 0;
}
Note that with the above we may not find all the entries for comctl32.ocx since it may be defined with the alternatives "%SystemRoot%\Windows\System32\comctl32.ocx" or "comctl32.ocx" so it would be more appropriate to check the last 12 chars of the string.
Last edited by bilm_ks; Feb 11th, 2006 at 03:24 PM.
"bla, bla,... exists number M so for each n > M bla, bla..." Exists? Where is it? (Kronecker said...)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|