How ignore any exception in DEBUG_EVENT and continue?












0















I have a code in my service application that execute a determinated process on SYSTEM account and in debug mode via CreateProcessAsUser.



The trouble is that debugged process stop for example when Google Chrome is opened or debugged process executes a great number of tasks simultaneously.



I think that the main trouble is the lack of "ignore any exception in debug and continue"..



Any help or suggestion will welcome.



    int Stop = 0;
DEBUG_EVENT DebugEv = { 0 };
DWORD dwContinueStatus = DBG_CONTINUE;

while (!Stop)
{
WaitForDebugEvent(&DebugEv, INFINITE);

switch (DebugEv.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
switch (DebugEv.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
break;
case EXCEPTION_BREAKPOINT:
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
break;
case EXCEPTION_SINGLE_STEP:
break;
case DBG_CONTROL_C:
break;
default:
break;
}
case CREATE_THREAD_DEBUG_EVENT:
break;
case CREATE_PROCESS_DEBUG_EVENT:
if (DebugEv.u.CreateProcessInfo.hFile)
CloseHandle(DebugEv.u.CreateProcessInfo.hFile);
break;
case EXIT_THREAD_DEBUG_EVENT:
break;
case EXIT_PROCESS_DEBUG_EVENT:
Stop = 1;
break;
case LOAD_DLL_DEBUG_EVENT:
if (DebugEv.u.LoadDll.hFile)
CloseHandle(DebugEv.u.LoadDll.hFile);
break;
case UNLOAD_DLL_DEBUG_EVENT:
break;
case OUTPUT_DEBUG_STRING_EVENT:
break;
}

ContinueDebugEvent(DebugEv.dwProcessId, DebugEv.dwThreadId, dwContinueStatus);
}









share|improve this question

























  • you continue copy-paste the same wrong and very not efficient code. which here not related to your question

    – RbMm
    Jan 19 at 14:54













  • @RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

    – Davison
    Jan 19 at 16:11













  • work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

    – RbMm
    Jan 19 at 17:18






  • 2





    if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

    – RbMm
    Jan 19 at 17:23






  • 1





    if you not handle exception in case EXCEPTION_DEBUG_EVENT:

    – RbMm
    Jan 19 at 17:26
















0















I have a code in my service application that execute a determinated process on SYSTEM account and in debug mode via CreateProcessAsUser.



The trouble is that debugged process stop for example when Google Chrome is opened or debugged process executes a great number of tasks simultaneously.



I think that the main trouble is the lack of "ignore any exception in debug and continue"..



Any help or suggestion will welcome.



    int Stop = 0;
DEBUG_EVENT DebugEv = { 0 };
DWORD dwContinueStatus = DBG_CONTINUE;

while (!Stop)
{
WaitForDebugEvent(&DebugEv, INFINITE);

switch (DebugEv.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
switch (DebugEv.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
break;
case EXCEPTION_BREAKPOINT:
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
break;
case EXCEPTION_SINGLE_STEP:
break;
case DBG_CONTROL_C:
break;
default:
break;
}
case CREATE_THREAD_DEBUG_EVENT:
break;
case CREATE_PROCESS_DEBUG_EVENT:
if (DebugEv.u.CreateProcessInfo.hFile)
CloseHandle(DebugEv.u.CreateProcessInfo.hFile);
break;
case EXIT_THREAD_DEBUG_EVENT:
break;
case EXIT_PROCESS_DEBUG_EVENT:
Stop = 1;
break;
case LOAD_DLL_DEBUG_EVENT:
if (DebugEv.u.LoadDll.hFile)
CloseHandle(DebugEv.u.LoadDll.hFile);
break;
case UNLOAD_DLL_DEBUG_EVENT:
break;
case OUTPUT_DEBUG_STRING_EVENT:
break;
}

ContinueDebugEvent(DebugEv.dwProcessId, DebugEv.dwThreadId, dwContinueStatus);
}









share|improve this question

























  • you continue copy-paste the same wrong and very not efficient code. which here not related to your question

    – RbMm
    Jan 19 at 14:54













  • @RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

    – Davison
    Jan 19 at 16:11













  • work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

    – RbMm
    Jan 19 at 17:18






  • 2





    if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

    – RbMm
    Jan 19 at 17:23






  • 1





    if you not handle exception in case EXCEPTION_DEBUG_EVENT:

    – RbMm
    Jan 19 at 17:26














0












0








0








I have a code in my service application that execute a determinated process on SYSTEM account and in debug mode via CreateProcessAsUser.



The trouble is that debugged process stop for example when Google Chrome is opened or debugged process executes a great number of tasks simultaneously.



I think that the main trouble is the lack of "ignore any exception in debug and continue"..



Any help or suggestion will welcome.



    int Stop = 0;
DEBUG_EVENT DebugEv = { 0 };
DWORD dwContinueStatus = DBG_CONTINUE;

while (!Stop)
{
WaitForDebugEvent(&DebugEv, INFINITE);

switch (DebugEv.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
switch (DebugEv.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
break;
case EXCEPTION_BREAKPOINT:
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
break;
case EXCEPTION_SINGLE_STEP:
break;
case DBG_CONTROL_C:
break;
default:
break;
}
case CREATE_THREAD_DEBUG_EVENT:
break;
case CREATE_PROCESS_DEBUG_EVENT:
if (DebugEv.u.CreateProcessInfo.hFile)
CloseHandle(DebugEv.u.CreateProcessInfo.hFile);
break;
case EXIT_THREAD_DEBUG_EVENT:
break;
case EXIT_PROCESS_DEBUG_EVENT:
Stop = 1;
break;
case LOAD_DLL_DEBUG_EVENT:
if (DebugEv.u.LoadDll.hFile)
CloseHandle(DebugEv.u.LoadDll.hFile);
break;
case UNLOAD_DLL_DEBUG_EVENT:
break;
case OUTPUT_DEBUG_STRING_EVENT:
break;
}

ContinueDebugEvent(DebugEv.dwProcessId, DebugEv.dwThreadId, dwContinueStatus);
}









share|improve this question
















I have a code in my service application that execute a determinated process on SYSTEM account and in debug mode via CreateProcessAsUser.



The trouble is that debugged process stop for example when Google Chrome is opened or debugged process executes a great number of tasks simultaneously.



I think that the main trouble is the lack of "ignore any exception in debug and continue"..



Any help or suggestion will welcome.



    int Stop = 0;
DEBUG_EVENT DebugEv = { 0 };
DWORD dwContinueStatus = DBG_CONTINUE;

while (!Stop)
{
WaitForDebugEvent(&DebugEv, INFINITE);

switch (DebugEv.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
switch (DebugEv.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
break;
case EXCEPTION_BREAKPOINT:
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
break;
case EXCEPTION_SINGLE_STEP:
break;
case DBG_CONTROL_C:
break;
default:
break;
}
case CREATE_THREAD_DEBUG_EVENT:
break;
case CREATE_PROCESS_DEBUG_EVENT:
if (DebugEv.u.CreateProcessInfo.hFile)
CloseHandle(DebugEv.u.CreateProcessInfo.hFile);
break;
case EXIT_THREAD_DEBUG_EVENT:
break;
case EXIT_PROCESS_DEBUG_EVENT:
Stop = 1;
break;
case LOAD_DLL_DEBUG_EVENT:
if (DebugEv.u.LoadDll.hFile)
CloseHandle(DebugEv.u.LoadDll.hFile);
break;
case UNLOAD_DLL_DEBUG_EVENT:
break;
case OUTPUT_DEBUG_STRING_EVENT:
break;
}

ContinueDebugEvent(DebugEv.dwProcessId, DebugEv.dwThreadId, dwContinueStatus);
}






c++ winapi visual-studio-2013 windows-services createprocessasuser






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 19 at 17:22







Davison

















asked Jan 19 at 14:38









DavisonDavison

1058




1058













  • you continue copy-paste the same wrong and very not efficient code. which here not related to your question

    – RbMm
    Jan 19 at 14:54













  • @RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

    – Davison
    Jan 19 at 16:11













  • work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

    – RbMm
    Jan 19 at 17:18






  • 2





    if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

    – RbMm
    Jan 19 at 17:23






  • 1





    if you not handle exception in case EXCEPTION_DEBUG_EVENT:

    – RbMm
    Jan 19 at 17:26



















  • you continue copy-paste the same wrong and very not efficient code. which here not related to your question

    – RbMm
    Jan 19 at 14:54













  • @RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

    – Davison
    Jan 19 at 16:11













  • work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

    – RbMm
    Jan 19 at 17:18






  • 2





    if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

    – RbMm
    Jan 19 at 17:23






  • 1





    if you not handle exception in case EXCEPTION_DEBUG_EVENT:

    – RbMm
    Jan 19 at 17:26

















you continue copy-paste the same wrong and very not efficient code. which here not related to your question

– RbMm
Jan 19 at 14:54







you continue copy-paste the same wrong and very not efficient code. which here not related to your question

– RbMm
Jan 19 at 14:54















@RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

– Davison
Jan 19 at 16:11







@RbMm, the part relative to CreateProcessAsUser() works fine, i posted in case someone want execute a complete code. The trouble is with the debug stretch.

– Davison
Jan 19 at 16:11















work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

– RbMm
Jan 19 at 17:18





work disgusting. for what SetTokenInformation which is always failed for example. for what winlogon.exe search and so on.

– RbMm
Jan 19 at 17:18




2




2





if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

– RbMm
Jan 19 at 17:23





if you not handle exception - you must return DBG_EXCEPTION_NOT_HANDLED

– RbMm
Jan 19 at 17:23




1




1





if you not handle exception in case EXCEPTION_DEBUG_EVENT:

– RbMm
Jan 19 at 17:26





if you not handle exception in case EXCEPTION_DEBUG_EVENT:

– RbMm
Jan 19 at 17:26












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54268171%2fhow-ignore-any-exception-in-debug-event-and-continue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54268171%2fhow-ignore-any-exception-in-debug-event-and-continue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage