CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Zombie dialog

  1. #1
    Join Date
    Dec 2004
    Location
    Poland
    Posts
    1,165

    Zombie dialog

    Hello everybody

    I am developing application which uses Microsoft Crypto API and I encountered strange behaviour, which I cannot explain. It is CONSOLE application, which performs signing data using certificate located at Windows certificate store. Everything seems to work fine, as long as certificate used to sign data has 'Use private key strong protection' option disabled (Im sorry, I have no English Windows version, and I do not know how exactly this option is called). When certificate has this option enabled, following thing should happen:
    1. My program calls CryptSignHash function (CryptoAPI function)
    2. Windows pops up MODAL dialog which says that protected certificate is going to be used
    3. User confirms (or cancels)
    4. Application runs further

    Strange thing is that application works like this:
    1. My program calls CryptSignHash function (CryptoAPI function)
    2. Program hangs, and stops responding
    3. When I restart program or just run another instance of it (when 1st one is sill frozen), program works as supposed.

    I found out that modal dialog which should be displayed by CryptSignHash function is created, but it is not displayed. It stays invisible and blocks instance of my application. It can be looked up using EnumWindows, FindWindow or Spy++ and forced to display with ShowWindow and its hWnd. Then user is able to confirm or reject operation and all works OK. Whats strange, since this time dialog behaves correctly: it pops up and can be clicked when user wants to sign data again. Only first call to CryptSignHash is stopped by this 'zombie' dialog window and gets frozen.

    I use WinXP Prof SP2 and MSVC 7.1

    If anyone knows any workaround for this, or ever encountered invisible modal windows, or has any idea whats going on, please help.

    Thank you
    Hob
    B+!
    'There is no cat' - A. Einstein

    Use [code] [/code] tags!

    Did YOU share your photo with us at CG Members photo gallery ?

  2. #2
    Join Date
    May 2000
    Location
    Washington DC, USA
    Posts
    715

    Re: Zombie dialog

    well you should mark your dialog as VISIBLE in your dialog properties in the dialog editor.

    You wouldn't be tinkering in the WM_PAINT message call would you?
    Where do you call SHOWWINDOW from?
    What other window messages are you using?

    It is CONSOLE application, which performs signing data using certificate located at Windows
    How exactly are you calling a dialog from a consol application? If you're instanciating your dialog, and you don't want this behavoir you might try creating a modless instead of a modal dialog.

  3. #3
    Join Date
    Dec 2004
    Location
    Poland
    Posts
    1,165

    Re: Zombie dialog

    I think that you misunderstood me: NEITHER CryptSignHash function, NOR troublesome dialog window is MINE. Function comes from Microsoft CryptoAPI (and its enclosed in some dll) and it pops dialog up. And I also thought that calling graphical elements from console app can be a cause, but I saw a lot of programs which work in this way and behave correctly.

    Hob
    B+!
    'There is no cat' - A. Einstein

    Use [code] [/code] tags!

    Did YOU share your photo with us at CG Members photo gallery ?

  4. #4
    Join Date
    Aug 2021
    Posts
    1

    Re: Zombie dialog

    Hi Hobson,
    I have the same problem and I wondered if you have a solution for it.

    Thanks

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,624

    Re: Zombie dialog

    Quote Originally Posted by amacias View Post
    Hi Hobson,
    I have the same problem and I wondered if you have a solution for it.

    Thanks
    Hobson hasn't been seen here since 2013

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured