Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6342027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:09:31+00:00 2026-05-24T20:09:31+00:00

I am using RegisterWaitForSingleObject to wait on a serial comm events as registered with

  • 0

I am using RegisterWaitForSingleObject to wait on a serial comm events as registered with WaitCommEvent.

The code works well on Windows XP however always throws an exception somewhere in the treadpool when running on Windows 7.

The stack trace shows

ntdll.dll!_TppWaiterpThread@4()  + 0x3a7ee bytes    
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes   
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes    

Is there any way to get this function to operate correctly in Windows 7 or will I need to re-write with support for the new Windows Vista/7 threadpool functions.

Here is an example of how I am calling the code. As stated this works flawlessly on XP

// Calback is on an object defined as a static function
class CommPortCallback
{
public:
    static void WINAPI serialLayerCallback( PVOID lpParameter, 
                                  BOOLEAN TimerOrWaitFired )
    {
        ....
    }
};

// wait is registered later as such
RegisterWaitForSingleObject(&pWaitData->callbackHandle, m_readOverlapped, 
        CommPortCallback::serialLayerCallback, pBaseCallback, 
        INFINITE, WT_EXECUTEONLYONCE) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:09:32+00:00Added an answer on May 24, 2026 at 8:09 pm

    Show the code calling RegisterWaitForSingleObject.

    At a guess, your callback function has the wrong calling convention or wrong parameter types, you’re using a function pointer cast to overrule the compiler’s complaint, and then the stack pointer is left misaligned after the call.


    With the code the cause is now clear: You’re passing in a pointer to the OVERLAPPED structure, instead of the event handle. It doesn’t seem like this should ever have worked correctly on XP, but whether or not it crashes or fails silently could well vary with Windows version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
The documentation for RegisterWaitForSingleObject says Using a Mutex for waitObject does not provide mutual
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I'm trying to watch a directory for changes using the FindFirstChangeNotification function. This works
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
I am using RegisterWaitForSingleObject to watch a directory for changes. I only need to
Using of mobile dialog authentication is working well for other mobile devices except on
Using jQuery rotate http://code.google.com/p/jqueryrotate/wiki/Examples to animate an object from 0 degrees to 40 degrees
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.