P/Invoke DeviceIoControl

  • Thread starter Thread starter Alexander Guhl
  • Start date Start date
A

Alexander Guhl

Hi,

i want to P/Invoke the WinCE DeviveIoControl function from my C# Project.
Can Anyone tell me where I can find out the values for IOCTL_SERVICE_STATUS,
IOCTL_SERVICE_STOP and IOCTL_SERVICE_START ?

Thanks
Alexander Guhl
 
Can Anyone tell me where I can find out the values for IOCTL_SERVICE_STATUS,
IOCTL_SERVICE_STOP and IOCTL_SERVICE_START ?

hmm they are in service.h but only for CE >4
thats not what i wantet
 
These IOCTL's are defined in service.h, a header file that comes with
Platform Builder. IOCTL's are actually defined using a macro that you can
find in the header file winioctl.h that you can find under the include
directory of an installed SDK (like the PocketPC 2002 SDK). The IOCTL's you
are asking for are defined as:

#define IOCTL_SERVICE_START CTL_CODE(FILE_DEVICE_SERVICE, 1,
METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_SERVICE_STOP CTL_CODE(FILE_DEVICE_SERVICE, 2, METHOD_BUFFERED,
FILE_ANY_ACCESS)

#define IOCTL_SERVICE_STATUS CTL_CODE(FILE_DEVICE_SERVICE, 8,
METHOD_BUFFERED, FILE_ANY_ACCESS)
 
#define IOCTL_SERVICE_START CTL_CODE(FILE_DEVICE_SERVICE, 1,
METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_SERVICE_STOP CTL_CODE(FILE_DEVICE_SERVICE, 2, METHOD_BUFFERED,

#define IOCTL_SERVICE_STATUS CTL_CODE(FILE_DEVICE_SERVICE, 8,
METHOD_BUFFERED, FILE_ANY_ACCESS)

Thank You very much for your help.
But what I need (I think) is the dword value of these constants, I can't
find FILE_DEVICE_SERVICE ...
I want to stop the OBEX service on a PocketPc2002 with DeviceIoControl from
within a C# program.
Does this work anyway? or are there better ways to do so?

Alex
 
The easiest thing to do is write a C program with eVC and have it print the
values for you. I don't think that there is a service manager in PPC2002,
so I don't think you can request that a service be stopped. It's probably
loaded as a driver by the Device Manager, so you may have to look up its
handle in the registry (if that even works), and DeactivateDevice().

Paul T.
 
I believe I tried this before and found the handle in the registry is not
valid outside of the device manager's context, so it fails to deactivate
from an external app.

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net
 
Thank you all for your help.
Seems like this wont work as i thought.
Do you see any posibilities to disable the Beam feature from code?
How does the Beam Applet in /Settings/Connections work?


Alexander Guhl
 
Back
Top