Re: beginthread in DrvDocumentEvent crashes under NT4 by Ashwin
Ashwin
Thu Feb 05 13:49:43 CST 2004
Also, you should compile the driver using the NT4 DDK instead of the XP DDK.
There are no real changes required. But in order to run it on NT4, it needs
to be compiled with the headers in the NT4 DDK.
--
- Ashwin
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dan Negrescu" <dnegrescu@NO-hot-SPAM-mail.com> wrote in message
news:eZQlP6y6DHA.2656@TK2MSFTNGP11.phx.gbl...
> Stefan,
>
> You are right, the UI dll runs in user-mode.
>
> Where exactly the crash happend ? Does your thread proc. gets executed at
> all ?
>
> The _beginthread() function expects that the thread procedure calling
> convention be __cdecl which
> might not be the default one for your build environment, so you may want
to
> explicitly use the __cdecl
> modifier.
>
> Have you tried using the _beginthreadex() finction ? This one is more
> flexible than the _beginthread(),
> and the thread proc calling convention is __stdcall instead of __cdecl.
>
> Also if you don't use the C runtime library inside the thread proc. then
you
> could even use directly the
> Windows API CreateThread()/ExitThread() functions.
>
> Dan.
>
>
>
> "Stefan Wanger" <Stefan.Wanger@cib.de> wrote in message
> news:bvqrp5$viq$1@svr7.m-online.net...
> > Really kernel mode. I thought the DrvDocumentEvent in the UI dll runs in
> > user-mode in the context
> > of the calling app.
> >
> > Am i wrong?
> >
> >
> >
> > "Jeff Henkels" <jeff@mapson.privatemail.com> schrieb im Newsbeitrag
> > news:uT3zu8x6DHA.2392@TK2MSFTNGP11.phx.gbl...
> > > _beginthread is a MSVC run-time-library function, which calls the
> Windows
> > > CreateThread API (a user-mode function, not intended to be called from
> > > kernel mode). Calling it from a driver is not a good thing.
> > >
> > > If you're creating threads in your driver, PsCreateSystemThread is the
> way
> > > to go.
> > >
> > > "Stefan Wanger" <Stefan.Wanger@cib.de> wrote in message
> > > news:bvq1se$o1f$1@svr7.m-online.net...
> > > > The driver is compiled in C++ under XP. It generally runs under NT4,
> > > except
> > > > that a beginthread crashes every application. Must it be compiled
> unter
> > > NT4
> > > > or do i have to take special settings. The only thing i do for NT4
is
> to
> > > > define -D_WIN32_WINNT=0x0400.
> > > >
> > > > Any ideas?
> > > >
> > > >
> > >
> > >
> >
> >
>
>