Click here to Skip to main content
15,881,380 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: can't run unicode/normalize example Pin
Adam Roderick J2-Apr-10 18:17
Adam Roderick J2-Apr-10 18:17 
QuestionRedefination error [modified] Pin
darc koder2-Apr-10 9:47
darc koder2-Apr-10 9:47 
AnswerRe: Redefination error Pin
Rick York2-Apr-10 10:18
mveRick York2-Apr-10 10:18 
GeneralRe: Redefination error Pin
darc koder2-Apr-10 10:40
darc koder2-Apr-10 10:40 
GeneralRe: Redefination error Pin
Rick York2-Apr-10 10:52
mveRick York2-Apr-10 10:52 
AnswerRe: Redefination error Pin
Tim Craig2-Apr-10 14:09
Tim Craig2-Apr-10 14:09 
AnswerRe: Redefination error Pin
«_Superman_»2-Apr-10 15:27
professional«_Superman_»2-Apr-10 15:27 
QuestionDuplicate Handle to get Real Process Handle Pin
ForNow2-Apr-10 8:29
ForNow2-Apr-10 8:29 
Hi,

I have read Jeffery Richter book On Duplicating Object Handles and am still confused how to get a real process handle

so...

If I am in a Childprocess trying to duplicate its handle for the Parent

I tried the following code in the Child Process

p.s. can some one point to where the documentation is for for using code tags for code snipets

I was sure it was on the menu bar from the Home page .....

<br />
<br />
       snap_shot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br />
<br />
        process32.dwSize = sizeof(PROCESSENTRY32);<br />
<br />
        return_cde =     Process32First(snap_shot,&process32);<br />
<br />
        pid = GetCurrentProcessId();       // Get Current process id<br />
<br />
        while(pid != process32.th32ProcessID)<br />
    {<br />
       return_cde = Process32Next(snap_shot,&process32);<br />
     }<br />
<br />
   parent_process = process32.th32ParentProcessID;<br />
<br />


then DuplicateHandle(GetCurrentProcesId(),GetCurrentProcessId(),parent_process,&child_process_handle_in_context_of_parent,0,FALSE,DUPLICATE_SAME_ACCESS);

no Luck


In Parent process

<br />
<br />
       return_code = CreateProcess(NULL,<br />
                        (LPCSTR) &child_buff[0],<br />
                          NULL,<br />
                          NULL,<br />
                          TRUE,<br />
                           NULL,<br />
                           NULL,<br />
                           NULL,<br />
                           &si,<br />
                           &pi);<br />
<br />
   global_area_handle =   pi.hProcess<br />
<br />
the DuplicateHandle(GetCurrentProcessId(),GetCurrentProcessId(),global_area_handle,&parent_in_context_of_child_handle,0,FALSE,DUPLICATE_SAME_ACCESS);<br />
<br />
no luck<br />
<br />


thankx
AnswerRe: Duplicate Handle to get Real Process Handle Pin
Richard MacCutchan2-Apr-10 9:30
mveRichard MacCutchan2-Apr-10 9:30 
QuestionCComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Vaclav_2-Apr-10 8:24
Vaclav_2-Apr-10 8:24 
AnswerRe: CComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Richard MacCutchan2-Apr-10 9:32
mveRichard MacCutchan2-Apr-10 9:32 
GeneralRe: CComboBox "right allign text" option moves the list box selection arrow to the left (VC 6.0 MFC) Pin
Vaclav_2-Apr-10 15:41
Vaclav_2-Apr-10 15:41 
Questionlimited user in xp Pin
Boost20102-Apr-10 6:49
Boost20102-Apr-10 6:49 
QuestionRe: limited user in xp Pin
David Crow2-Apr-10 8:01
David Crow2-Apr-10 8:01 
AnswerRe: limited user in xp Pin
Boost20102-Apr-10 8:21
Boost20102-Apr-10 8:21 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:24
David Crow2-Apr-10 8:24 
GeneralRe: limited user in xp Pin
Boost20102-Apr-10 8:37
Boost20102-Apr-10 8:37 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:40
David Crow2-Apr-10 8:40 
GeneralRe: limited user in xp Pin
Boost20102-Apr-10 8:43
Boost20102-Apr-10 8:43 
GeneralRe: limited user in xp Pin
David Crow2-Apr-10 8:46
David Crow2-Apr-10 8:46 
GeneralRe: limited user in xp Pin
Boost20102-Apr-10 8:56
Boost20102-Apr-10 8:56 
QuestionCannot access the ClassView information file, ClassView information will not be available. Pin
includeh102-Apr-10 6:23
includeh102-Apr-10 6:23 
AnswerRe: Cannot access the ClassView information file, ClassView information will not be available. Pin
Maximilien2-Apr-10 6:38
Maximilien2-Apr-10 6:38 
GeneralRe: Cannot access the ClassView information file, ClassView information will not be available. Pin
includeh102-Apr-10 6:51
includeh102-Apr-10 6:51 
AnswerRe: Cannot access the ClassView information file, ClassView information will not be available. Pin
David Crow2-Apr-10 8:02
David Crow2-Apr-10 8:02 

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.