Click here to Skip to main content
15,890,506 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Meauring CPU time of C code in milliseconds Pin
Peter_in_278030-Apr-12 18:51
professionalPeter_in_278030-Apr-12 18:51 
Questionc++ win32 CreateThread, Wait, final testing Pin
jkirkerx30-Apr-12 16:54
professionaljkirkerx30-Apr-12 16:54 
QuestionRe: c++ win32 CreateThread, Wait, final testing Pin
Code-o-mat1-May-12 0:29
Code-o-mat1-May-12 0:29 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:57
professionaljkirkerx1-May-12 6:57 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin1-May-12 3:46
professionalAlbert Holguin1-May-12 3:46 
GeneralRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:59
professionaljkirkerx1-May-12 6:59 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin2-May-12 5:35
professionalAlbert Holguin2-May-12 5:35 
AnswerI've traced it down to this Pin
jkirkerx1-May-12 13:55
professionaljkirkerx1-May-12 13:55 
I've traced my issues down to the parameters that I'm passing to the thread. I must of implemented it wrong, and left it in memory. I thought it clears automatically when the thread exits.

So this is on the CreateThread Side of the Function, and of course I read the parameters back on the Thread side.

Question:

do I have to clean up here manually, or is it automatic?

// Create a common memory space for threads
PMAIN_RUNPROCESS pzUpdateProcess;
pzUpdateProcess = ( PMAIN_RUNPROCESS ) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( PMAIN_RUNPROCESS ));

// Now copy the pointers over to the heap
pzUpdateProcess->m_hWndDlg = _updates_Dialog_hWnd;
pzUpdateProcess->m_StatusMessage = lbl_Update_Dialog_StatusMessage_Label;
pzUpdateProcess->m_ProgressBar = pb_Update_Dialog_ProgressBar_Field;

// CreateThread for running Process
hThread = (HANDLE)CreateThread(
    &sa,
    0,
    &_updates_Dialog_CreateProcess_Thread,
    pzUpdateProcess,
    0,
    &dwThreadID
);


The Code Analyst is complaining about a DPAC (ACL) or something below. Is it really needed for proper operation?

SECURITY_ATTRIBUTES sa;
    sa.bInheritHandle = TRUE;
    sa.lpSecurityDescriptor = NULL;
    sa.lpSecurityDescriptor = (PSECURITY_DESCRIPTOR) malloc(SECURITY_DESCRIPTOR_MIN_LENGTH);
    InitializeSecurityDescriptor(sa.lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
    
    // The Code Analyst is complaining about dPAC I think where the null is, 
    SetSecurityDescriptorDacl(sa.lpSecurityDescriptor, TRUE, (PACL) ->NULL<-, FALSE);</b>

    sa.nLength = sizeof(sa);
    sa.bInheritHandle = TRUE;
    sa.nLength=sizeof(SECURITY_ATTRIBUTES);

GeneralSolved Now Pin
jkirkerx1-May-12 17:35
professionaljkirkerx1-May-12 17:35 
AnswerRe: Solved Now Pin
Albert Holguin1-May-12 18:22
professionalAlbert Holguin1-May-12 18:22 
GeneralRe: Solved Now Pin
jkirkerx1-May-12 18:33
professionaljkirkerx1-May-12 18:33 
GeneralRe: Solved Now Pin
Albert Holguin2-May-12 5:36
professionalAlbert Holguin2-May-12 5:36 
Question[Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 12:24
_Kel_30-Apr-12 12:24 
AnswerRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 12:54
professionalRichard Andrew x6430-Apr-12 12:54 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 13:18
_Kel_30-Apr-12 13:18 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 13:22
professionalRichard Andrew x6430-Apr-12 13:22 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 14:30
_Kel_30-Apr-12 14:30 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 14:43
professionalRichard Andrew x6430-Apr-12 14:43 
QuestionOnInitDialog? Pin
Le Quang Long30-Apr-12 4:38
Le Quang Long30-Apr-12 4:38 
AnswerRe: OnInitDialog? Pin
Maximilien30-Apr-12 5:03
Maximilien30-Apr-12 5:03 
GeneralRe: OnInitDialog? Pin
Le Quang Long30-Apr-12 6:20
Le Quang Long30-Apr-12 6:20 
QuestionRe: OnInitDialog? Pin
David Crow30-Apr-12 6:07
David Crow30-Apr-12 6:07 
AnswerRe: OnInitDialog? Pin
Le Quang Long30-Apr-12 14:11
Le Quang Long30-Apr-12 14:11 
QuestionRestrict Copy and Paste Pin
john563229-Apr-12 18:35
john563229-Apr-12 18:35 
AnswerRe: Restrict Copy and Paste Pin
_AnsHUMAN_ 29-Apr-12 22:29
_AnsHUMAN_ 29-Apr-12 22:29 

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.