|
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.
|
|
|
|
|
I have a CListCtrl in my dialog. I want its size to be just fit enough to display the list elements, as in the control should resize itself based on the number of elements to be displayed(which is not known at compile time). It should not have a vertical scrollbar.
How can I do this?
Thanks
|
|
|
|
|
Hi
After populating your listbox with values, you can use CListCtrl::GetItemRect (with LVIR_BOUNDS code) to determine the size of the individual items in the list, calculate the total size, and resize the listctrl accordingly.
HTH
Martin
|
|
|
|
|
|
dim13 wrote:
Please, share.
please explain...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I mean ZModem protocol for transfer files through modem connection.
Dim
|
|
|
|
|
|
Thank you for links.
I think that this problem is old enough to be already solved.
Is it too specific or too complicated but I can't find the sources.
It seems that I have to port sz and rz by myself
Dim
|
|
|
|
|
I have created a simple application which host a web browser in the Dialog box , I have tried to retrieve the pointer of the webbrowser parent but it is null why is it like that ,, I have just droped the control in the dialog box and created an object of the webbrowser control .
|
|
|
|
|
Shouldn't it be the dialog window itself?
|
|
|
|
|
yes It should be . but thats wat not happening here . I dont know why
|
|
|
|
|
ok i have a problem in my main.cpp of my client program, and i have been staring at the screen for so long i can't see what the problem is
[code]c:\documents and settings\computing\desktop\client2\main.cpp(17) : error C2660: 'connecttoserver' : function does not take 0 parameters
mesagesend.cpp
Error executing cl.exe.[/code]
[code]#include "connecting.h"
#include <iostream>
#include "mesagesend.h"
#include <winsock2.h>
#include <stdio.h>
using namespace std;
int main()
{
connecting client;
mesagesend chat;
client.connecttoserver();
chat.sendmessage();
client.disconnectfromserver(chat.mysocket);
return 0;
}[/code]
|
|
|
|
|
The connecttoserver function must need one or more parameters. Look in in "connecting.h" (or post it here) to see the parameters the method takes.
Mike
|
|
|
|
|
ok, i tell you what i see ...
main.cpp, line 17 :
client.connecttoserver();
chris28583 wrote:
c:\documents and settings\computing\desktop\client2\main.cpp(17) : error C2660: 'connecttoserver' : function does not take 0 parameters
nothing to add... :->
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi.
How to use Visual C++ to create a program for Input/Output via USB port?
Many thanks for help.
|
|
|
|
|
What do you mean exactly when you say: 'via USB Port' ? Are you using a USB-To-Serial adapter or another USB device ?
Fir the second case, a driver is shipped with the device and there shoulb documentation included. You must open the port using the CreateFile function specifying the name of the device you want to access. Then you use the DeviceIoControl function to send command to the driver.
Hope this helps
|
|
|
|
|
I participate in a project in which I have to establish comminication betwen Digital Signal Processor and PC via USB. This is the beginning of the project and we don't know that DSP would be the best. I will give more information as soon as the specification of the project is more clear.
Thanks!
|
|
|
|
|
Hi can somebody give me some code samples of the createENtry,CopyEntries and deleteentry using MAPI. i am not having enough reference on MAPI. In the IMapiContainer::CreateEntry method the ulflags are not working , can any one clarify me why it does not work. and also suggest me some books on MAPI or some sites where MAPI is available.
thanx in advance
vsr
VSR
|
|
|
|
|
Hello,
I have a problem and I hope somebody will solve this, because I'm getting crazy.
I have to execute parallel commands from an application:
e.g: to execute paralel commands like:
dir & notepad.exe
where &=parallel operator
How can I make this, using commands like CreateProcess and system(char *) call, without creating new instances of my application ,and without using CreateThread function.
I know that this is posible, but I don't know how.
Thank you!
|
|
|
|
|
Hi,
I made a program that burns cd's and dvd's. But when I start burning a CD the main screen gets inactive. I can't use any buttons and when I minimize the screen, I can't get it back.
Does anybody know how to solve this?
Grtz
|
|
|
|
|
Your program is busy with the cd/dvd writing and cant handle any other stuff until it finishes the writing task.
To solve shift the cd/dvd writing task on to a separate thread. This would leave your main application window open for inputs.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
|
how to get information about all installed software of my PC ,programatically in VC,I mean is there any API ??
i m final year computer engineer student...ant making project "Asset manager for LAN" i want information of all hardware and software installed in LAN and want to manage them.i got some APIs for geting hardware information ..now i want APIs for software information
actuly i want to make such thing that if any user detach any hardware or software then one message should there on server that this user have removed this hardware from this PC in LAN
|
|
|
|
|
All the Information of Installed Software on local system can be find here
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
you have to Enumerate the registry Key to know each installed Software.
For Enumertaion of registry key you can use these API->
<ul><br />
<li>RegEnumKey<br />
<li>RegEnumKeyEx<br />
</ul>
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
WMI is the one of the solution to get h/w information .
Reg
Ramesh.k
VISUAL C++/ATL/COM PROJECTS
|
|
|
|