_VWIN32_CreateRing0Thread

Dear all,

can u please send me an example code on how to use _VWIN32_CreateRing0Thread call and threading in ring0 level on win9x platform … or any tips on using that call… 'coz documentation in 98ddk doesn’t say much about this…

Thanks in advance

som


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi.

This is my own sample source code. Think it’ll help you.

//===================================================================
typedef
VOID
(__stdcall *PRING0_PROC)(
DWORD dwStartParam
);

typedef struct _RING_THREAD_HANDLES {
DWORD Ring3ThreadHandle;
PTCB Ring0ThreadHandle;
} RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;

RING_THREAD_HANDLES VXDINLINE
_VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
{
__asm push ebx
__asm push esi
__asm mov ecx,[dwRing3StackSize]
__asm mov edx,[dwStartParam]
__asm mov ebx,[Ring0StartFunc]
__asm mov esi,[FailCallback]
VxDCall(_VWIN32_CreateRing0Thread)
__asm pop esi
__asm pop ebx
}
//===================================================================
//
//===================================================================
VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
{
// …
// Here you can put your thread function
// …
}
//===================================================================
//
//===================================================================
VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
{
RING_THREAD_HANDLES ThreadHandles;
PTCB Ring0Thread;

ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
Ring0Thread=ThreadHandles.Ring0ThreadHandle;

if (Ring0Thread == NULL)
{
KdPrint((“THREAD: CreateRing0Thread(): thread creation failed\n”));
}

else
{
KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
0x%08X\n”,Ring0Thread));
Set_Thread_Win32_Pri(Ring0Thread,4);
Adjust_Thread_Exec_Priority(Ring0Thread,0);
}
}

Konstantin Manurin (aka NizeG)
Programmer
Nival Interactive
mailto:xxxxx@nival.com

10a bld. 5, 1st Volokolamsky proezd
Moscow 123060 Russia
Tel: +7 (095) 363-9630
Tel: +7 (095) 363 9636
http://www.nival.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>From my early VxD experience I remember that it is a good idea to
save/restore all registers on entry/exit of your thread-function.
Was it ebx that needs to be preserved ?? – I do not remember any
more! Maybe a problem arises only on W95Gold if you do not preserve
registers.

| Norbert Kawulski | mailto:xxxxx@stollmann.de |
| Stollmann T.P.GmbH, Development | http://www.stollmann.de |
–If it’s ISDN or Bluetooth, make sure it’s driven by Stollmann–

“I cannot give you the formula for success, but; I can give the the
formula for failure- which is: try to please everybody. - Herbert
Bayard Swope”


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

dear Konstantin,

I’ve tried the code sent by you… but here also system hangs at VxdCall
( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
… any suggestion is welcome from anybody…

thanks

som
----- Original Message -----
From: “Konstantin Manurin”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 2:08 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Hi.
>
> This is my own sample source code. Think it’ll help you.
>
> //===================================================================
> typedef
> VOID
> (__stdcall *PRING0_PROC)(
> DWORD dwStartParam
> );
>
> typedef struct _RING_THREAD_HANDLES {
> DWORD Ring3ThreadHandle;
> PTCB Ring0ThreadHandle;
> } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
>
> RING_THREAD_HANDLES VXDINLINE
> _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> {
>__asm push ebx
> asm push esi
>
asm mov ecx,[dwRing3StackSize]
> __asm mov edx,[dwStartParam]
>__asm mov ebx,[Ring0StartFunc]
> __asm mov esi,[FailCallback]
> VxDCall(_VWIN32_CreateRing0Thread)
>__asm pop esi
> asm pop ebx
> }
> //===================================================================
> //
> //===================================================================
> VOID
stdcall Ring0ThreadFunction(DWORD dwStartParam)
> {
> // …
> // Here you can put your thread function
> // …
> }
> //===================================================================
> //
> //===================================================================
> VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> {
> RING_THREAD_HANDLES ThreadHandles;
> PTCB Ring0Thread;
>
> ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> Ring0Thread=ThreadHandles.Ring0ThreadHandle;
>
> if (Ring0Thread == NULL)
> {
> KdPrint((“THREAD: CreateRing0Thread(): thread creation
failed\n”));
> }
>
> else
> {
> KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> 0x%08X\n”,Ring0Thread));
> Set_Thread_Win32_Pri(Ring0Thread,4);
> Adjust_Thread_Exec_Priority(Ring0Thread,0);
> }
> }
>
>
>
> Konstantin Manurin (aka NizeG)
> Programmer
> Nival Interactive
> mailto:xxxxx@nival.com
>
> 10a bld. 5, 1st Volokolamsky proezd
> Moscow 123060 Russia
> Tel: +7 (095) 363-9630
> Tel: +7 (095) 363 9636
> http://www.nival.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Could you send me your thread function source code? I used this service and
everything was fine. I also used VMMCreateThreadEx() service.

----- Original Message -----
From: “Somsubhra Raj”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 2:01 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> dear Konstantin,
>
> I’ve tried the code sent by you… but here also system hangs at
VxdCall
> ( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
> … any suggestion is welcome from anybody…
>
> thanks
>
> som
> ----- Original Message -----
> From: “Konstantin Manurin”
> To: “NT Developers Interest List”
> Sent: Thursday, January 24, 2002 2:08 PM
> Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
>
>
> > Hi.
> >
> > This is my own sample source code. Think it’ll help you.
> >
> > //===================================================================
> > typedef
> > VOID
> > (__stdcall *PRING0_PROC)(
> > DWORD dwStartParam
> > );
> >
> > typedef struct _RING_THREAD_HANDLES {
> > DWORD Ring3ThreadHandle;
> > PTCB Ring0ThreadHandle;
> > } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
> >
> > RING_THREAD_HANDLES VXDINLINE
> > _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> > Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> > {
> >__asm push ebx
> > asm push esi
> >
asm mov ecx,[dwRing3StackSize]
> > __asm mov edx,[dwStartParam]
> >__asm mov ebx,[Ring0StartFunc]
> > __asm mov esi,[FailCallback]
> > VxDCall(_VWIN32_CreateRing0Thread)
> >__asm pop esi
> > asm pop ebx
> > }
> > //===================================================================
> > //
> > //===================================================================
> > VOID
stdcall Ring0ThreadFunction(DWORD dwStartParam)
> > {
> > // …
> > // Here you can put your thread function
> > // …
> > }
> > //===================================================================
> > //
> > //===================================================================
> > VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> > {
> > RING_THREAD_HANDLES ThreadHandles;
> > PTCB Ring0Thread;
> >
> > ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> > Ring0Thread=ThreadHandles.Ring0ThreadHandle;
> >
> > if (Ring0Thread == NULL)
> > {
> > KdPrint((“THREAD: CreateRing0Thread(): thread creation
> failed\n”));
> > }
> >
> > else
> > {
> > KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> > 0x%08X\n”,Ring0Thread));
> > Set_Thread_Win32_Pri(Ring0Thread,4);
> > Adjust_Thread_Exec_Priority(Ring0Thread,0);
> > }
> > }
> >
> >
> >
> > Konstantin Manurin (aka NizeG)
> > Programmer
> > Nival Interactive
> > mailto:xxxxx@nival.com
> >
> > 10a bld. 5, 1st Volokolamsky proezd
> > Moscow 123060 Russia
> > Tel: +7 (095) 363-9630
> > Tel: +7 (095) 363 9636
> > http://www.nival.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nival.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks Constantin…

I’ll try with these… mail u back if some problem happens…

som

----- Original Message -----
From: “Konstantin Manurin”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 2:08 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Hi.
>
> This is my own sample source code. Think it’ll help you.
>
> //===================================================================
> typedef
> VOID
> (__stdcall *PRING0_PROC)(
> DWORD dwStartParam
> );
>
> typedef struct _RING_THREAD_HANDLES {
> DWORD Ring3ThreadHandle;
> PTCB Ring0ThreadHandle;
> } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
>
> RING_THREAD_HANDLES VXDINLINE
> _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> {
>__asm push ebx
> asm push esi
>
asm mov ecx,[dwRing3StackSize]
> __asm mov edx,[dwStartParam]
>__asm mov ebx,[Ring0StartFunc]
> __asm mov esi,[FailCallback]
> VxDCall(_VWIN32_CreateRing0Thread)
>__asm pop esi
> asm pop ebx
> }
> //===================================================================
> //
> //===================================================================
> VOID
stdcall Ring0ThreadFunction(DWORD dwStartParam)
> {
> // …
> // Here you can put your thread function
> // …
> }
> //===================================================================
> //
> //===================================================================
> VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> {
> RING_THREAD_HANDLES ThreadHandles;
> PTCB Ring0Thread;
>
> ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> Ring0Thread=ThreadHandles.Ring0ThreadHandle;
>
> if (Ring0Thread == NULL)
> {
> KdPrint((“THREAD: CreateRing0Thread(): thread creation
failed\n”));
> }
>
> else
> {
> KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> 0x%08X\n”,Ring0Thread));
> Set_Thread_Win32_Pri(Ring0Thread,4);
> Adjust_Thread_Exec_Priority(Ring0Thread,0);
> }
> }
>
>
>
> Konstantin Manurin (aka NizeG)
> Programmer
> Nival Interactive
> mailto:xxxxx@nival.com
>
> 10a bld. 5, 1st Volokolamsky proezd
> Moscow 123060 Russia
> Tel: +7 (095) 363-9630
> Tel: +7 (095) 363 9636
> http://www.nival.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Dear Konstantin,

actually I’m writing a scsi miniport driver. Here if I put the create thread
call in driverentry or any other places the call hangs… only it works
for SCSIOP_READ call and that is also if the call comes while system boot
up… so not getting where to put the ‘_VWIN32_CreateRing0Thread’
function to create a thread.

here goes the source for function for which I’m creating the thread…

VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
{
// …
// Here you can put your thread function
// …
while(1)
{
Wait_Semaphore( hSemHandle , BLOCK_THREAD_IDLE);
//check = 1;
Destroy_Semaphore ( hSemHandle );
hSemHandle = 0;

ReadFromFile(ThreadData.luExtension, ThreadData.sectors, ThreadData.bsize,
0);

if ( ThreadData.luExtension->IsFileOpened == 0 )
{
ThreadData.luExtension->ActiveLuRequest->DataTransferLength = 0;
}

if ( ThreadData.luExtension->BadBlock == 1)
{
ThreadData.Srb->SrbStatus = SRB_STATUS_ERROR;
FillSenseInfo(ThreadData.luExtension,ThreadData.Srb,4);
}
else
{
ThreadData.Srb->ScsiStatus = SCSISTAT_GOOD;
ThreadData.Srb->SrbStatus = SRB_STATUS_SUCCESS;
}

ThreadData.luExtension->BadBlock = 0;

if ( DataFinished == 2 )
DataFinished = 1;

Signal_Semaphore( hSemHandle1 );

hSemHandle = Create_Semaphore( 0 );
}

return;

}

Thanks in advance…

som

----- Original Message -----
From: “Konstantin Manurin”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 5:27 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Could you send me your thread function source code? I used this service
and
> everything was fine. I also used VMMCreateThreadEx() service.
>
> ----- Original Message -----
> From: “Somsubhra Raj”
> To: “NT Developers Interest List”
> Sent: Thursday, January 24, 2002 2:01 PM
> Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
>
>
> > dear Konstantin,
> >
> > I’ve tried the code sent by you… but here also system hangs at
> VxdCall
> > ( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
> > … any suggestion is welcome from anybody…
> >
> > thanks
> >
> > som
> > ----- Original Message -----
> > From: “Konstantin Manurin”
> > To: “NT Developers Interest List”
> > Sent: Thursday, January 24, 2002 2:08 PM
> > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> >
> >
> > > Hi.
> > >
> > > This is my own sample source code. Think it’ll help you.
> > >
> > > //===================================================================
> > > typedef
> > > VOID
> > > (__stdcall *PRING0_PROC)(
> > > DWORD dwStartParam
> > > );
> > >
> > > typedef struct _RING_THREAD_HANDLES {
> > > DWORD Ring3ThreadHandle;
> > > PTCB Ring0ThreadHandle;
> > > } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
> > >
> > > RING_THREAD_HANDLES VXDINLINE
> > > _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> > > Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> > > {
> > >__asm push ebx
> > > asm push esi
> > >
asm mov ecx,[dwRing3StackSize]
> > > __asm mov edx,[dwStartParam]
> > >__asm mov ebx,[Ring0StartFunc]
> > > __asm mov esi,[FailCallback]
> > > VxDCall(_VWIN32_CreateRing0Thread)
> > >__asm pop esi
> > > asm pop ebx
> > > }
> > > //===================================================================
> > > //
> > > //===================================================================
> > > VOID
stdcall Ring0ThreadFunction(DWORD dwStartParam)
> > > {
> > > // …
> > > // Here you can put your thread function
> > > // …
> > > }
> > > //===================================================================
> > > //
> > > //===================================================================
> > > VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> > > {
> > > RING_THREAD_HANDLES ThreadHandles;
> > > PTCB Ring0Thread;
> > >
> > >
ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> > > Ring0Thread=ThreadHandles.Ring0ThreadHandle;
> > >
> > > if (Ring0Thread == NULL)
> > > {
> > > KdPrint((“THREAD: CreateRing0Thread(): thread creation
> > failed\n”));
> > > }
> > >
> > > else
> > > {
> > > KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> > > 0x%08X\n”,Ring0Thread));
> > > Set_Thread_Win32_Pri(Ring0Thread,4);
> > > Adjust_Thread_Exec_Priority(Ring0Thread,0);
> > > }
> > > }
> > >
> > >
> > >
> > > Konstantin Manurin (aka NizeG)
> > > Programmer
> > > Nival Interactive
> > > mailto:xxxxx@nival.com
> > >
> > > 10a bld. 5, 1st Volokolamsky proezd
> > > Moscow 123060 Russia
> > > Tel: +7 (095) 363-9630
> > > Tel: +7 (095) 363 9636
> > > http://www.nival.com
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nival.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Konstantin,

In case to use VMMCreateThread Vxd service … can u send me the wrapper
for that call…

thanks in advance

som

----- Original Message -----
From: “Konstantin Manurin”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 5:27 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Could you send me your thread function source code? I used this service
and
> everything was fine. I also used VMMCreateThreadEx() service.
>
> ----- Original Message -----
> From: “Somsubhra Raj”
> To: “NT Developers Interest List”
> Sent: Thursday, January 24, 2002 2:01 PM
> Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
>
>
> > dear Konstantin,
> >
> > I’ve tried the code sent by you… but here also system hangs at
> VxdCall
> > ( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
> > … any suggestion is welcome from anybody…
> >
> > thanks
> >
> > som
> > ----- Original Message -----
> > From: “Konstantin Manurin”
> > To: “NT Developers Interest List”
> > Sent: Thursday, January 24, 2002 2:08 PM
> > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> >
> >
> > > Hi.
> > >
> > > This is my own sample source code. Think it’ll help you.
> > >
> > > //===================================================================
> > > typedef
> > > VOID
> > > (__stdcall *PRING0_PROC)(
> > > DWORD dwStartParam
> > > );
> > >
> > > typedef struct _RING_THREAD_HANDLES {
> > > DWORD Ring3ThreadHandle;
> > > PTCB Ring0ThreadHandle;
> > > } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
> > >
> > > RING_THREAD_HANDLES VXDINLINE
> > > _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> > > Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> > > {
> > >__asm push ebx
> > > asm push esi
> > >
asm mov ecx,[dwRing3StackSize]
> > > __asm mov edx,[dwStartParam]
> > >__asm mov ebx,[Ring0StartFunc]
> > > __asm mov esi,[FailCallback]
> > > VxDCall(_VWIN32_CreateRing0Thread)
> > >__asm pop esi
> > > asm pop ebx
> > > }
> > > //===================================================================
> > > //
> > > //===================================================================
> > > VOID
stdcall Ring0ThreadFunction(DWORD dwStartParam)
> > > {
> > > // …
> > > // Here you can put your thread function
> > > // …
> > > }
> > > //===================================================================
> > > //
> > > //===================================================================
> > > VOID __stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> > > {
> > > RING_THREAD_HANDLES ThreadHandles;
> > > PTCB Ring0Thread;
> > >
> > >
ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> > > Ring0Thread=ThreadHandles.Ring0ThreadHandle;
> > >
> > > if (Ring0Thread == NULL)
> > > {
> > > KdPrint((“THREAD: CreateRing0Thread(): thread creation
> > failed\n”));
> > > }
> > >
> > > else
> > > {
> > > KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> > > 0x%08X\n”,Ring0Thread));
> > > Set_Thread_Win32_Pri(Ring0Thread,4);
> > > Adjust_Thread_Exec_Priority(Ring0Thread,0);
> > > }
> > > }
> > >
> > >
> > >
> > > Konstantin Manurin (aka NizeG)
> > > Programmer
> > > Nival Interactive
> > > mailto:xxxxx@nival.com
> > >
> > > 10a bld. 5, 1st Volokolamsky proezd
> > > Moscow 123060 Russia
> > > Tel: +7 (095) 363-9630
> > > Tel: +7 (095) 363 9636
> > > http://www.nival.com
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nival.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Although DDK doesnt directly state it, it appears _VWIN32_CreateRing0Thread
can be called “at APPY time” only. See DDK help on Application Time Events.
You should install an appytime callback with see _SHELL_CallAtAppyTime and
call _VWIN32_CreateRing0Thread from this callback…

Hope this helps…

Vladimir

----- Original Message -----
From: “Somsubhra Raj”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 6:35 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Dear Konstantin,
>
> actually I’m writing a scsi miniport driver. Here if I put the create
thread
> call in driverentry or any other places the call hangs… only it
works
> for SCSIOP_READ call and that is also if the call comes while system boot
> up… so not getting where to put the ‘_VWIN32_CreateRing0Thread’
> function to create a thread.
>
> here goes the source for function for which I’m creating the thread…
>
> VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
> {
> // …
> // Here you can put your thread function
> // …
> while(1)
> {
> Wait_Semaphore( hSemHandle , BLOCK_THREAD_IDLE);
> file://check = 1;
> Destroy_Semaphore ( hSemHandle );
> hSemHandle = 0;
>
> ReadFromFile(ThreadData.luExtension, ThreadData.sectors,
ThreadData.bsize,
> 0);
>
> if ( ThreadData.luExtension->IsFileOpened == 0 )
> {
> ThreadData.luExtension->ActiveLuRequest->DataTransferLength = 0;
> }
>
> if ( ThreadData.luExtension->BadBlock == 1)
> {
> ThreadData.Srb->SrbStatus = SRB_STATUS_ERROR;
> FillSenseInfo(ThreadData.luExtension,ThreadData.Srb,4);
> }
> else
> {
> ThreadData.Srb->ScsiStatus = SCSISTAT_GOOD;
> ThreadData.Srb->SrbStatus = SRB_STATUS_SUCCESS;
> }
>
> ThreadData.luExtension->BadBlock = 0;
>
> if ( DataFinished == 2 )
> DataFinished = 1;
>
> Signal_Semaphore( hSemHandle1 );
>
> hSemHandle = Create_Semaphore( 0 );
> }
>
> return;
>
> }
>
> Thanks in advance…
>
> som
>
> ----- Original Message -----
> From: “Konstantin Manurin”
> To: “NT Developers Interest List”
> Sent: Thursday, January 24, 2002 5:27 PM
> Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
>
>
> > Could you send me your thread function source code? I used this service
> and
> > everything was fine. I also used VMMCreateThreadEx() service.
> >
> > ----- Original Message -----
> > From: “Somsubhra Raj”
> > To: “NT Developers Interest List”
> > Sent: Thursday, January 24, 2002 2:01 PM
> > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> >
> >
> > > dear Konstantin,
> > >
> > > I’ve tried the code sent by you… but here also system hangs at
> > VxdCall
> > > ( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
> > > … any suggestion is welcome from anybody…
> > >
> > > thanks
> > >
> > > som
> > > ----- Original Message -----
> > > From: “Konstantin Manurin”
> > > To: “NT Developers Interest List”
> > > Sent: Thursday, January 24, 2002 2:08 PM
> > > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> > >
> > >
> > > > Hi.
> > > >
> > > > This is my own sample source code. Think it’ll help you.
> > > >
> > > >
file://===================================================================
> > > > typedef
> > > > VOID
> > > > (__stdcall *PRING0_PROC)(
> > > > DWORD dwStartParam
> > > > );
> > > >
> > > > typedef struct _RING_THREAD_HANDLES {
> > > > DWORD Ring3ThreadHandle;
> > > > PTCB Ring0ThreadHandle;
> > > > } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
> > > >
> > > > RING_THREAD_HANDLES VXDINLINE
> > > > _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> > > > Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> > > > {
> > > > asm push ebx
> > > >
asm push esi
> > > > __asm mov ecx,[dwRing3StackSize]
> > > >__asm mov edx,[dwStartParam]
> > > > __asm mov ebx,[Ring0StartFunc]
> > > >__asm mov esi,[FailCallback]
> > > > VxDCall(_VWIN32_CreateRing0Thread)
> > > > asm pop esi
> > > >
asm pop ebx
> > > > }
> > > >
file://===================================================================
> > > > //
> > > >
file://===================================================================
> > > > VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
> > > > {
> > > > // …
> > > > // Here you can put your thread function
> > > > // …
> > > > }
> > > >
file://===================================================================
> > > > //
> > > >
file://===================================================================
> > > > VOID__stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> > > > {
> > > > RING_THREAD_HANDLES ThreadHandles;
> > > > PTCB Ring0Thread;
> > > >
> > > >
> ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> > > > Ring0Thread=ThreadHandles.Ring0ThreadHandle;
> > > >
> > > > if (Ring0Thread == NULL)
> > > > {
> > > > KdPrint((“THREAD: CreateRing0Thread(): thread creation
> > > failed\n”));
> > > > }
> > > >
> > > > else
> > > > {
> > > > KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> > > > 0x%08X\n”,Ring0Thread));
> > > > Set_Thread_Win32_Pri(Ring0Thread,4);
> > > > Adjust_Thread_Exec_Priority(Ring0Thread,0);
> > > > }
> > > > }
> > > >
> > > >
> > > >
> > > > Konstantin Manurin (aka NizeG)
> > > > Programmer
> > > > Nival Interactive
> > > > mailto:xxxxx@nival.com
> > > >
> > > > 10a bld. 5, 1st Volokolamsky proezd
> > > > Moscow 123060 Russia
> > > > Tel: +7 (095) 363-9630
> > > > Tel: +7 (095) 363 9636
> > > > http://www.nival.com
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as:
xxxxx@yahoo.com
> > > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nival.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@narod.ru
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Although DDK doesnt directly state it, it appears _VWIN32_CreateRing0Thread
can be called “at APPY time” only. See DDK help on Application Time Events.
You should install an appytime callback with see _SHELL_CallAtAppyTime and
call _VWIN32_CreateRing0Thread ONLY from this callback…

Hope this helps…

Vladimir

----- Original Message -----
From: “Somsubhra Raj”
To: “NT Developers Interest List”
Sent: Thursday, January 24, 2002 6:35 PM
Subject: [ntdev] Re: _VWIN32_CreateRing0Thread

> Dear Konstantin,
>
> actually I’m writing a scsi miniport driver. Here if I put the create
thread
> call in driverentry or any other places the call hangs… only it
works
> for SCSIOP_READ call and that is also if the call comes while system boot
> up… so not getting where to put the ‘_VWIN32_CreateRing0Thread’
> function to create a thread.
>
> here goes the source for function for which I’m creating the thread…
>
> VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
> {
> // …
> // Here you can put your thread function
> // …
> while(1)
> {
> Wait_Semaphore( hSemHandle , BLOCK_THREAD_IDLE);
> file://check = 1;
> Destroy_Semaphore ( hSemHandle );
> hSemHandle = 0;
>
> ReadFromFile(ThreadData.luExtension, ThreadData.sectors,
ThreadData.bsize,
> 0);
>
> if ( ThreadData.luExtension->IsFileOpened == 0 )
> {
> ThreadData.luExtension->ActiveLuRequest->DataTransferLength = 0;
> }
>
> if ( ThreadData.luExtension->BadBlock == 1)
> {
> ThreadData.Srb->SrbStatus = SRB_STATUS_ERROR;
> FillSenseInfo(ThreadData.luExtension,ThreadData.Srb,4);
> }
> else
> {
> ThreadData.Srb->ScsiStatus = SCSISTAT_GOOD;
> ThreadData.Srb->SrbStatus = SRB_STATUS_SUCCESS;
> }
>
> ThreadData.luExtension->BadBlock = 0;
>
> if ( DataFinished == 2 )
> DataFinished = 1;
>
> Signal_Semaphore( hSemHandle1 );
>
> hSemHandle = Create_Semaphore( 0 );
> }
>
> return;
>
> }
>
> Thanks in advance…
>
> som
>
> ----- Original Message -----
> From: “Konstantin Manurin”
> To: “NT Developers Interest List”
> Sent: Thursday, January 24, 2002 5:27 PM
> Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
>
>
> > Could you send me your thread function source code? I used this service
> and
> > everything was fine. I also used VMMCreateThreadEx() service.
> >
> > ----- Original Message -----
> > From: “Somsubhra Raj”
> > To: “NT Developers Interest List”
> > Sent: Thursday, January 24, 2002 2:01 PM
> > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> >
> >
> > > dear Konstantin,
> > >
> > > I’ve tried the code sent by you… but here also system hangs at
> > VxdCall
> > > ( _VWIN32_CreateRing0Thread)… I debugged it with softice ver1.5
> > > … any suggestion is welcome from anybody…
> > >
> > > thanks
> > >
> > > som
> > > ----- Original Message -----
> > > From: “Konstantin Manurin”
> > > To: “NT Developers Interest List”
> > > Sent: Thursday, January 24, 2002 2:08 PM
> > > Subject: [ntdev] Re: _VWIN32_CreateRing0Thread
> > >
> > >
> > > > Hi.
> > > >
> > > > This is my own sample source code. Think it’ll help you.
> > > >
> > > >
file://===================================================================
> > > > typedef
> > > > VOID
> > > > (__stdcall *PRING0_PROC)(
> > > > DWORD dwStartParam
> > > > );
> > > >
> > > > typedef struct _RING_THREAD_HANDLES {
> > > > DWORD Ring3ThreadHandle;
> > > > PTCB Ring0ThreadHandle;
> > > > } RING_THREAD_HANDLES,*PRING_THREAD_HANDLES;
> > > >
> > > > RING_THREAD_HANDLES VXDINLINE
> > > > _VWIN32_CreateRing0Thread(DWORD dwRing3StackSize,PRING0_PROC
> > > > Ring0StartFunc,PRING0_PROC FailCallback,DWORD dwStartParam)
> > > > {
> > > > asm push ebx
> > > >
asm push esi
> > > > __asm mov ecx,[dwRing3StackSize]
> > > >__asm mov edx,[dwStartParam]
> > > > __asm mov ebx,[Ring0StartFunc]
> > > >__asm mov esi,[FailCallback]
> > > > VxDCall(_VWIN32_CreateRing0Thread)
> > > > asm pop esi
> > > >
asm pop ebx
> > > > }
> > > >
file://===================================================================
> > > > //
> > > >
file://===================================================================
> > > > VOID __stdcall Ring0ThreadFunction(DWORD dwStartParam)
> > > > {
> > > > // …
> > > > // Here you can put your thread function
> > > > // …
> > > > }
> > > >
file://===================================================================
> > > > //
> > > >
file://===================================================================
> > > > VOID__stdcall CreateRing0Thread(PRING0_PROC ThreadFunction)
> > > > {
> > > > RING_THREAD_HANDLES ThreadHandles;
> > > > PTCB Ring0Thread;
> > > >
> > > >
> ThreadHandles=_VWIN32_CreateRing0Thread(4096,ThreadFunction,NULL,0);
> > > > Ring0Thread=ThreadHandles.Ring0ThreadHandle;
> > > >
> > > > if (Ring0Thread == NULL)
> > > > {
> > > > KdPrint((“THREAD: CreateRing0Thread(): thread creation
> > > failed\n”));
> > > > }
> > > >
> > > > else
> > > > {
> > > > KdPrint((“THREAD: CreateRing0Thread(): Ring0Thread:
> > > > 0x%08X\n”,Ring0Thread));
> > > > Set_Thread_Win32_Pri(Ring0Thread,4);
> > > > Adjust_Thread_Exec_Priority(Ring0Thread,0);
> > > > }
> > > > }
> > > >
> > > >
> > > >
> > > > Konstantin Manurin (aka NizeG)
> > > > Programmer
> > > > Nival Interactive
> > > > mailto:xxxxx@nival.com
> > > >
> > > > 10a bld. 5, 1st Volokolamsky proezd
> > > > Moscow 123060 Russia
> > > > Tel: +7 (095) 363-9630
> > > > Tel: +7 (095) 363 9636
> > > > http://www.nival.com
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as:
xxxxx@yahoo.com
> > > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nival.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@narod.ru
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com