Click here to Skip to main content
15,889,877 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to export and import IE's favorates? Pin
Aric Wang4-Apr-10 0:44
Aric Wang4-Apr-10 0:44 
Questionmshflexgrid Pin
Member 5903102-Apr-10 21:27
Member 5903102-Apr-10 21:27 
AnswerRe: mshflexgrid Pin
Richard MacCutchan2-Apr-10 23:20
mveRichard MacCutchan2-Apr-10 23:20 
QuestionModeless Dialog Pin
rjkg2-Apr-10 21:25
rjkg2-Apr-10 21:25 
AnswerRe: Modeless Dialog Pin
Code-o-mat2-Apr-10 23:20
Code-o-mat2-Apr-10 23:20 
GeneralRe: Modeless Dialog Pin
rjkg3-Apr-10 0:14
rjkg3-Apr-10 0:14 
GeneralRe: Modeless Dialog Pin
Code-o-mat3-Apr-10 4:32
Code-o-mat3-Apr-10 4:32 
GeneralRe: Modeless Dialog Pin
Adam Roderick J3-Apr-10 5:26
Adam Roderick J3-Apr-10 5:26 
QuestionC++ syntax: any idea to avoid overwriting functions of base class? Pin
includeh102-Apr-10 20:13
includeh102-Apr-10 20:13 
AnswerRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
CPallini2-Apr-10 23:15
mveCPallini2-Apr-10 23:15 
AnswerRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
Richard MacCutchan2-Apr-10 23:17
mveRichard MacCutchan2-Apr-10 23:17 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
includeh103-Apr-10 8:22
includeh103-Apr-10 8:22 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? PinPopular
Richard MacCutchan3-Apr-10 9:22
mveRichard MacCutchan3-Apr-10 9:22 
GeneralRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
Leif Simon Goodwin4-Apr-10 2:09
Leif Simon Goodwin4-Apr-10 2:09 
AnswerRe: C++ syntax: any idea to avoid overwriting functions of base class? Pin
Bernódus Kristinsson24-Apr-10 14:27
Bernódus Kristinsson24-Apr-10 14:27 
Questioncan't run unicode/normalize example Pin
permutations2-Apr-10 16:09
permutations2-Apr-10 16:09 
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 

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.