The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => The Orphanage => Topic started by: Magnum on December 23, 2010, 02:14:38 PM

Title: Consequences if program was ended by Task Manager
Post by: Magnum on December 23, 2010, 02:14:38 PM
I would like to plan for different possibilities that may occur when
a program is run.

What would happen to the O.S. if the program was ended by Task Manager? 

What other "collateral damage" could occur ?


.ELSEIF uMsg==WM_DESTROY
            invoke UnregisterHotKey,hWnd,065h
       
            invoke GlobalFree,hglb; help by Nathan in comp.lang.asm.x86

            invoke PostQuitMessage,NULL
      .ELSEIF uMsg == WM_HOTKEY

; Put text on the clipboard.
 
    invoke OpenClipboard,NULL
    .IF (eax)

      invoke EmptyClipboard
      invoke GlobalAlloc,GMEM_MOVEABLE, 128; Allocate some space.

    .IF (eax)
        mov hglb, eax
        invoke GlobalLock,hglb
         
  mov ebx, eax
  push ebx       ; Save ebx
 
  mov eax, lParam
  shr eax, 16
 
            .if     ax == 65  ; If the key 65 ("A") was pressed.
     invoke MemCopy,ADDR str1,ebx,SIZEOF str1
 
            .elseif ax == 66  ; If the key 66 ("B") was pressed.
          invoke MemCopy,ADDR str2,ebx,SIZEOF str2
 
            .else
  ; Some other key pressed.
  .endif

       invoke SetClipboardData,CF_TEXT,hglb
         
    .IF (eax == 0)

         invoke MessageBox,NULL, ADDR AppName,ADDR Mess1,  MB_ICONEXCLAMATION
    .ENDIF

    pop eax   ; Restore the value that was saved from ebx
    invoke GlobalUnlock, eax

    .ELSE

       invoke MessageBox,NULL, ADDR AppName,ADDR Mess2,  MB_ICONEXCLAMATION

    .ENDIF
invoke GlobalFree, hglb
       invoke CloseClipboard
Title: Re: Consequences if program was ended by Task Manager
Post by: ToutEnMasm on December 23, 2010, 03:12:15 PM
Quote
What would happen to the O.S. if the program was ended by Task Manager?
On win XP ,vista,win 7 ,NOTHING
For the program,all data can be lost.
Title: Re: Consequences if program was ended by Task Manager
Post by: Magnum on December 23, 2010, 04:31:39 PM
So, are you saying that only my keyboard shortcuts would be lost?

Title: Re: Consequences if program was ended by Task Manager
Post by: ToutEnMasm on December 23, 2010, 04:36:58 PM

All things installed by your program would be lost (keyboard shortcuts,...),YES