Click here to Skip to main content
16,004,887 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhy GDI&GDI+ occurs most of CPU time when they are used at the same time? Pin
wpxu6-Jan-05 2:39
professionalwpxu6-Jan-05 2:39 
AnswerRe: Why GDI&GDI+ occurs most of CPU time when they are used at the same time? Pin
PJ Arends6-Jan-05 8:18
professionalPJ Arends6-Jan-05 8:18 
QuestionHow to migrate .lib to dll Pin
alhadav6-Jan-05 2:35
alhadav6-Jan-05 2:35 
AnswerRe: How to migrate .lib to dll Pin
basementman6-Jan-05 4:33
basementman6-Jan-05 4:33 
GeneralRe: How to migrate .lib to dll Pin
Anonymous6-Jan-05 4:43
Anonymous6-Jan-05 4:43 
GeneralRe: How to migrate .lib to dll Pin
basementman6-Jan-05 5:11
basementman6-Jan-05 5:11 
GeneralRe: How to migrate .lib to dll Pin
Jim Crafton6-Jan-05 16:26
Jim Crafton6-Jan-05 16:26 
QuestionHow can I use "User SID" to run a process? Pin
mayash756-Jan-05 2:13
mayash756-Jan-05 2:13 
I want to write two simple c programs.
Important: There should be no client-server communication between them. They should communicate via a simple text file only.

The idea I want to implement is explained by the following example:

Assume that user "bob" in the domain "dom1" logged-on to the computer and executed PROGRAM A. Program A runs now under the security context of bob.
I want PROGRAM A to be able to take bob's access token, or bob's user sid, or bob's security context, and write it to a text file on the disk.

Now "bob" logs-off, and another user named "administrator" in the same domain ("dim1") logs-on to the same computer. "administrator" runs PROGRAM B. I want that PROGRAM B will retrieve the data of "bob" from the text file (that was created by program A), and use it to create a process that will run under the user context of "bob".
I.E. - I want PROGRAM B to be able to create a process that will run under the user context of "bob", without even knowing the password of "bob", but only his access token/user Sid/security context from a static file.

After searching the MSDN and some internet sites, I had an idea how to do that, but I am stuck now.

I will be grateful if anyone can help me to complete my idea or suggest other ideas...

My idea is described below:

Program A does:
1. Gets the user SID from the security token of itself (using OpenProcessToken
and GetTokenInformation with TokenUser)
2. It converts the User SID to a string format, using ConvertSidToStringSid,
and writes it to a file.

Program B does:
1. Read the file that was produced by the first program, and get the User SID
from it.
2. Convert the user SID from string to a valid binary user Sid, using
ConvertStringSidToSid.

The problem: I want Program B to use this user SID in order to create a process that will run under the user context that is represented by this user Sid.
The thing is that I don't know how to implement a creation of a process using user SID.
Does anyone have any idea?

Some notes:

1. It could be good if I had a way, in program B to create a "default" token and set its "User SID" field according to the user sid that was read from the file (and then use CreateProcessWithTokenW), but I didnt find a way to do that ("SetTokenInformation" enables set of other contents of a token, but not the user Sid).

2. There are functions to CreateProcessWithLogonW, CreateProcessWithTokenW,
CreateProcessAsUser, but I didnt find any function to create process with SID...

3. At first I thought about different implementation: that program A will take the whole access token of "bob" (and not only the sid) and write it to a text file. This way program B could read the token from the text file and use
CreateProcessWithTokenW...
But I didnt find a way to do that, because the token is a HANDLE, and I didnt find a way to write it in a text file in a way that it can be retrieved from it later and used by another program...

I will appreciate any kind of help,
Thanks a lot,
Maya.
GeneralResizing CListCtrl Pin
laavsjj6-Jan-05 1:02
laavsjj6-Jan-05 1:02 
GeneralRe: Resizing CListCtrl Pin
Martin Koorts6-Jan-05 2:57
Martin Koorts6-Jan-05 2:57 
GeneralIs anyone see source code of ZModem for win32?(-) Pin
dim136-Jan-05 0:47
dim136-Jan-05 0:47 
GeneralRe: Is anyone see source code of ZModem for win32?(-) Pin
toxcct6-Jan-05 3:02
toxcct6-Jan-05 3:02 
GeneralRe: Is anyone see source code of ZModem for win32?(-) Pin
dim139-Jan-05 22:06
dim139-Jan-05 22:06 
GeneralRe: Is anyone see source code of ZModem for win32?(-) Pin
Ravi Bhavnani6-Jan-05 4:56
professionalRavi Bhavnani6-Jan-05 4:56 
GeneralRe: Is anyone see source code of ZModem for win32?(-) Pin
dim139-Jan-05 21:54
dim139-Jan-05 21:54 
GeneralUnable to get the parent of the webbrowser control hosted in a dialog box Pin
Anonymous6-Jan-05 0:00
Anonymous6-Jan-05 0:00 
GeneralRe: Unable to get the parent of the webbrowser control hosted in a dialog box Pin
Rouslan Grabar [Russ]6-Jan-05 1:18
Rouslan Grabar [Russ]6-Jan-05 1:18 
GeneralRe: Unable to get the parent of the webbrowser control hosted in a dialog box Pin
Anonymous6-Jan-05 17:56
Anonymous6-Jan-05 17:56 
Generalfunction passing problem Pin
chris285835-Jan-05 23:51
chris285835-Jan-05 23:51 
GeneralRe: function passing problem Pin
Mike Beckerleg6-Jan-05 0:35
Mike Beckerleg6-Jan-05 0:35 
GeneralRe: function passing problem Pin
toxcct6-Jan-05 3:06
toxcct6-Jan-05 3:06 
GeneralUSB in Visual C++ Pin
Johnny Peszek5-Jan-05 23:06
Johnny Peszek5-Jan-05 23:06 
GeneralRe: USB in Visual C++ Pin
Cedric Moonen6-Jan-05 1:09
Cedric Moonen6-Jan-05 1:09 
GeneralRe: USB in Visual C++ Pin
Johnny Peszek6-Jan-05 3:11
Johnny Peszek6-Jan-05 3:11 
GeneralMAPI Addressbook Pin
suboo_vedagiri5-Jan-05 22:56
suboo_vedagiri5-Jan-05 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.