|
Hi Obliterator
I'm having the same problem right now with my application. Since this message is posted in Feb 2002, did you found the solution for this?
Thanks,
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
Well it seems the call is somewhat superfluous - it certainly is not needed for my app. However to be on the safe side I determine if the user has admin rights - if so I call the function, otherwise I simply skip the call.
If its really important you could demand admin privelledges for installation and call the function at the time. See KB Q254957[^] for more info.
Hope it helps.
...
if(CUserInfo::isUserPrivilege(DOMAIN_ALIAS_RID_ADMINS))
m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
...
BOOL CUserInfo::isUserPrivilege(DWORD dwSubAuthority)
{
TOKEN_GROUPS* tgTokens;
DWORD group_no;
PSID admin_psid;
HANDLE hToken, hProcess;
hProcess = GetCurrentProcess();
ASSERT(hProcess);
if(hProcess)
{
OpenProcessToken(hProcess, TOKEN_QUERY, &hToken);
ASSERT(hToken);
if(hToken)
{
GetTokenInformation(hToken, TokenGroups, NULL,0, &group_no);
{
tgTokens = (TOKEN_GROUPS*)new BYTE[group_no];
GetTokenInformation(hToken, TokenGroups, tgTokens, group_no, &group_no);
{
SID_IDENTIFIER_AUTHORITY authsid = SECURITY_NT_AUTHORITY;
if(AllocateAndInitializeSid(&authsid, 2, SECURITY_BUILTIN_DOMAIN_RID,
dwSubAuthority,0,0,0,0,0,0, &admin_psid))
{
for (int i = 0; i < tgTokens->GroupCount; i++)
if (EqualSid(tgTokens->Groups[i].Sid, admin_psid))
{
delete [] tgTokens;
CloseHandle(hToken);
FreeSid(admin_psid);
return TRUE;
}
return FALSE;
}
}
}
}
}
return FALSE;
}
--
The Obliterator
|
|
|
|
|
Hello:
I followed the link that you provided in your last post and that helped me out. Now it works and I'm not seeing any abnormalities when I run the application under an unprivileged user account. Thank you very much for taking your time and help me out with this. I really appreciate it.
Best regards,
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
I remember that some versions of UNIX have an algorithm that doesn´t allow you to change your password to an obvious password. Does anyone know any algorithm to identify obvious passwords ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
You can download CrackLib from here. This is what is used to check passwords in Linux, you need to figure out how to compile and use it under Windows.
|
|
|
|
|
In Linux there is a dictionary file that contains a list of common words. Linux wont let you use any of those words as passwd unless you are running as root. Then you can set any passwd, [even the username can be used as passwd] even though they show a warning. I also find that Linux automatically adds all usernames into its list of banwords.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Hi,
I´m trying to use an ActiveX in a Word automated doc, I manage to add it from my App, and execute some code ( and save the properties as well), but when I close my app and the Word instance, the ActiveX seems to be death, even it shows a message when I click on it, saying that the code is missing !??!??, How can I make work that ( should I go for all the sh*tty ole protocol even if I don´t want to set a toolbar ?).
Thanks, Bye !
Braulio
|
|
|
|
|
How do I can enumerate all exported functions from some DLL?
Thanks.
|
|
|
|
|
Use dumpbin /EXPORTS if you want to do it from the command line . If you want to do it programmatically you will have to parse the PE file format ( Matt Pietrek has some articles in MSDN magazine about that).
|
|
|
|
|
I would like to create a software (running under windows 98/ME) that allows the synchronisation (of a file, adresse book, calendar) between windows 98/ME/2000/Xp and Windows CE or Palm OS.
I already found a development kit on PalmOS.com to synchronise with a Palm (Conduit development kit). I am looking now to find a development kit for te synchronisation with Windows CE, or even better one that will work for both (windows CE and Palm).
Anyone has an idea ? )
|
|
|
|
|
|
Thanks Michael for your answer =)
I am downloading the "eMbedded Visual Tools" right now. It seems i should find everything i need to do a synchronisation between a pc and a pocket pc.
I am still looking for one tool that would allow me to do a synchronisation between a pc and a pocket pc (under Windows ME and a Palm OS).
|
|
|
|
|
Hi !
I'm doing an Asynchronous Pluggable Protocol to display HTML pages stored in a database.
Everythings work ok (I have implemented the IInternetProtocol and IInternetProtocolRoot interfaces, and Start and Read methods are called properly), but I catch an "Access Denied" error while displaying the page. The MSDN help mention the IInternetProtocolInfo::ParseUrl method to resolve security problem, but I don't have any example of this use...
Any help will be appreciate.
Emmanuel Derriey
|
|
|
|
|
I have a dialog box and I want to have access to my document class.How can I do it?
Thanks
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Try this:
(CMainFrame*)(AfxGetMainWnd())->GetActiveDocument();
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When I used that code,there was an error return,about "GetActiveDocument()"
but I change it to this"
CMainFrame * pWnd =dynamic_cast<CMainFrame *>(AfxGetApp()->m_pMainWnd);
ASSERT_VALID(pWnd);
CMyDoc * pDoc =dynamic_cast<CMyDoc *>(pWnd->GetActiveDocument());
ASSERT_VALID(pDoc);
and it work properly.
Anyway,thanks for your help
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Unless you have multiple inheritance somewhere in your class design, I don't see how dynamic_cast ing can make a difference (and even so I don't see it either). Would you mind elaborating a little more?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This is my first try:
CMyDoc * pDoc=(CMainFrame*)(AfxGetMainWnd())->GetActiveDocument();
error C2039: 'GetActiveDocument' : is not a member of 'CWnd'
My second attempt:
CMainFrame * pWnd =dynamic_cast<CMainFrame *>(AfxGetApp()->m_pMainWnd);
ASSERT_VALID(pWnd);
CMyDoc * pDoc=(CMyDoc*)(pWnd->GetActiveDocument());
and work properly,it's not related to dynamic_cast .
My mistake was about convert CMainFrame to CDocument
I think you forgot one line in your answer,didn't you?;)
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
I see now... What I forgot was an extra pair of parentheses
<font color=#ff0000>(</font>(CMainFrame*)(AfxGetMainWnd())<font color=#ff0000>)</font>->GetActiveDocument(); On a side note, I'd suggest you do not use dynamic_cast when it is not strictly needed, because it incurs a run-time overhead. It is like killing flies with cannonballs, as a Spanish saying goes.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
What I forgot was an extra pair of parentheses
And also I forgot to type cast it to CMyDoc in my first try
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here."Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Is there any function that will return the current CPU speed?
If not I plan on using the number of clocks spent / Number of seconds since boot. The question then becomes, does anyone know of a function that will return the number of milli-seconds since boot???
I believe there this exact value resides in the CMOS somewheres, but I don't think in/out instructions are available in ring 3???
Any suggestions...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
The question then becomes, does anyone know of a function that will return the number of milli-seconds since boot???
GetTickCount(). As for CPU info, check the System section here on CP.
--Mike--
Fetchez la vache!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
I'm already using the RTDSC instruction to find the clocks gone by. From this number i'd like to be able to calculate CPU frequency.
CPU speed = Clocks / time in seconds
What am I missing....how can I use GetTickCount to calculate CPU frequncy if i already have the clocks since boot?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
fCPU = clocks since boot / milliseconds since boot [kHz]
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Where do i get milliseconds if i already have clocks...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|