|
Wow...thanks for all this beautiful info! I was thinking along those lines earlier today, but my brain started hurting and i had to quit
It completely escaped me that i could get the token of the running explorer.exe. Thats almost certainly always running as the current user (except in the small chance that the user has replaced their shell).
I can't thank you enough for this awesome bit of help!
...alan
|
|
|
|
|
Neflyte wrote:
I can't thank you enough for this awesome bit of help!
no problem - and just to proove that the world sometimes is a nice place, here's some more - even if you dont use it now, its good stuff to remember for a rainy day (ps.. its 0:34am down here in Sydney, Australia, so If I make any spello's, you'll have to forgive me)
ok, references :-
1) 'Windows NT Security' by Nik Okuntseff has all sorts of gems - avail thru RDBOOKS, code downloadable
2) ** THE BEST ** 'Programming Windows Security', Keith Brown (I had Amazon fly me down a copy).. now, if you surf on over to www.develop.com/kbrown/security/samples.htm[^] check out the samples 'Session Viewer' and 'Token Dump Component' - these'll provide you with all the ammo I suspect you need, and yet another way of doing it, using the active desktop and Winsta0
sleep, must have sleep .. toodle pip from this side of the world ...
'G'
|
|
|
|
|
Okay, i've implemented most of what you wrote here. Now I'm at a different problem.
I'm able to get the access token of the currently logged on user, but when I call ImpersonateLoggedOnUser, i always get an 'Access is Denied' error from GetLastError().
I thought I might be able to circumvent using that function call by just calling CreateProcessAsUser, but something tells me that I need to ImpersonateLoggedOnUser() before i can make the CreateProcessAsUser call.
Any thoughts on that?
...alan
|
|
|
|
|
ouch .. this is now getting into a very hard area .. the best way of doing this, is to go back to afore-mentioned web page for Keith Brown, grab his cmdasuser example, read that, and all might become clear.. if it doesnt, and you're desperate to solve this problem, either for your boss or for a client, read on now .....
did I give you the url for www.quimeras.com[^] ??? - they sell a few components that make impersonation a breeze ie 'runas' type functionality ... there's also a 'Security Context Component' from www.codemill.net (www.codemill.net/products/secctx/doc.htm[^]) which I gather is meant for more 'webby' asp/iis ??? type stuff ...
you might ask, having fed you all the info I had, why then point you toward two commercial implementations ?? well, it would have taken significantly longer in one case to write/adapt other's code to my problem, so while knowing the theory behind what I was doing was very valuable (specially since I had to justify myself to our Security Manager in great detail), it was more expedient to simply purchase a product, get the job done, and move onto the next fight(Im not affiliated with quimeras or codemill - I just beleive they had the best quick way of solving the problem)
hope this helps ...
ps.. I beleive from memory, the answer lies in that the process doing the impersonation has to be 'priviliged', ie, running in a system context ...
good luck
'G'
|
|
|
|
|
Why is it that in
CModeLess::CModeLess(CWnd* pParent )
: CDialog(CModeLess::IDD, pParent)
{
m_parent=pParent;
}
I can send a message or post and it gets to the right view. But if I try to set a parent member (parent is CTView), it says thats not a member of CWnd....fine So I try to cast the m_pParent to a CTVIew* pointer, but it doesnt like it if I do a #include "tView.h" in the CDialog derived class, since "myCDlg.h" is included in TView.h....something circular going on...
SO I tried forward declaring the CTVIew class in my CDlg .h file but it didnt like that either....
SO why does my message get to the right parent, but I cant set a member of the parent? If I could cast it I could but it doesnt look like its legal...?
Appreciate your help,
ns
|
|
|
|
|
You'll have to #include tView.h in the cpp file, and summon the pointer when you need it rather than have it as a member of the class. I've had to do this before when working with incestuous modless dialogs in order to avoid circular inclusion.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
So you're saying I shouldnt save the parent pointer that comes into Create(). Guess I should be looking at getparent.....?
Appreciate your help,
ns
|
|
|
|
|
right.
CParentClass* pParent = static_cast<CParentClass*>(GetParent());
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hello to everyone
I have an *.exe file which i made in c++, and wrote it on a cd. But i have not save the files of the project. Now i want to change some things in the program and i cannot open the source code ( *.cpp) because i dont have it, only the *.exe file. Is there a way to retrive it or i have to make it again from the begging?
Please late me know if someone knows a way to do so.
Thanks for your time
Tace care all of youselves
|
|
|
|
|
It's gone.
Next time save your source. It's more valuable than the .exe
|
|
|
|
|
I know i should have keep the .cpp file but i didn't.
I dont understand how crackers break the .exe files and they are making cracks, it has to be a way to do it . Am i right?
|
|
|
|
|
wildelf wrote:
I dont understand how crackers break the .exe files and they are making cracks, it has to be a way to do it . Am i right?
Yep, but not with source code, they know assembler and EXE formats.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
where can i find someone who knows assembly an exe formats?
|
|
|
|
|
Beleive me, in many cases it is faster to re-write the source code then disassemble the exe (unless your exe not so big as MS Windows.
I'm not sure but I think if you included debug information in your exe, it could slightly simplify your task.
|
|
|
|
|
i don't know it for sure, but.... there is a way the decompile a program, right? i've seen someone do it once in visual something(i was a turbo pascal nerd than so i didn't understand anything of visual studio), he decompiled the explorer.exe and changed the start menu its logo's....
[]D [] []D []
|
|
|
|
|
In my OnBUttonOK() I calls CDialog OnOK();
I want to "delete this". Where does this line go...before the CDialog OnOK(); or after it, so that it is the last line in the function?
Appreciate your help,
ns
|
|
|
|
|
i suggest if u don't know how to use "delete this" u should not use it.
at the very least we need more information to determine what your trying to accomplish and therefore how/where you should use it.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
I created a modeless dialog with a new in a VIew cLass. Then after its spwaned and I press the OK button I have on the CDialog, it doe ssome stuff and then calls
CDialog::OnOK();
THe pointer I created with the new is the one i want to delete, so i was wondering if I should do it before or after the base call to OnOK....
Appreciate your help,
ns
|
|
|
|
|
just call DestroyWindow() where you want to end the dialog, and override the virtual function PostNcDestroy()(or handle WM_NCDESTROY if you dont use mfc) and write "delete this or some stuff" in it.
hope it works
|
|
|
|
|
I think I almost have a complete handle on this "new" stuff. Thanks for the info....also I read a CP article om modeless dlgs that helped..
Appreciate your help,
ns
|
|
|
|
|
I was a bit unsure with some info in it, but I am going to try it and see if I interpreted it correctly. Thanks for helping
Appreciate your help,
ns
|
|
|
|
|
I lost the exact syntax, but sometimes I'l make a copy of a perfectly fine project and when I load the new copuy, it says : error , and resource.rc. could not be...
How does one fix this and why does this happen?
Appreciate your help,
ns
|
|
|
|
|
Hi,
I am calling a Dialog box from a propery page. The dialog box contains an edit box which takes in numbers as user inputs. I then want these numbers to be used on the property page.
However, as I "OK" the dialog box and go back to it, the numbers have changed back to what the constructor contains.
I have used UpdataData(TRUE); but it continues to revert back to the original numbers.
void CMyPropPage::OnCallMyDlgButton() <br />
{<br />
UpdateData(TRUE);<br />
CMyDlg ViewData;<br />
ViewData.DoModal();<br />
UpdateData(FALSE);<br />
}
Have I missed something out?
kash
|
|
|
|
|
Kash wrote:
Have I missed something out?
Yep!
MSDN[^]says:
The framework automatically calls UpdateData
with bSaveAndValidate set to FALSE when a modal
dialog box is created in the default implementation
of CDialog::OnInitDialog. The call occurs before
the dialog box is visible. The default
implementation of CDialog::OnOK calls this member
function with bSaveAndValidate set to TRUE to
retrieve the data, and if successful, will close
the dialog box. So you Do not have to call UpdataData() yourself:
void CMyPropPage::OnCallMyDlgButton()
{
CMyDlg ViewData;
if (ViewData.DoModal()==IDOK)
m_Number = ViewData.m_Number;
}
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
yep that works, but when I re-open the dialog box, the changes have been lost. I want to keep the changes fixed and not for it to revert to the constructor values of the dlg box.
kash
|
|
|
|