none
CTL_CODE Function code list RRS feed

  • Question

  • Hi,

          I believe this questions has been asked before here : http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/47e61d3a-2597-4da6-b865-150c00eac54f.

    However, the replies don't seem to answer the question correctly as far as I understand. I need the function codes list that can be used with the CTL_CODE macro. Where can I obtain this list at? Specifically, I am interested in obtaining or knowing more about the function code #37 and 38. Thanks.

    Tuesday, June 28, 2011 10:41 PM

All replies

  • If you installed PB,

    You can find CTL_CODE macro list  define in the "%$WINCEROOT%\PUBLIC\COMMON\OAK\INC\pkfuncs.h" file;

    the function code #37 is "IOCTL_KITL_GET_INFO"

    the function code #38 is "IOCTL_HAL_REQUEST_SYSINTR"

     

     

     

     


    Wednesday, June 29, 2011 1:53 AM
  • I would say that "the function code #37 is "IOCTL_KITL_GET_INFO" the function code #38 is "IOCTL_HAL_REQUEST_SYSINTR""  is not necessarly true:

    the CTL_CODE macro, as we know, has 4 parameters: DeviceType, Function, Method, Access.

    The meaning of the function code depends on the device, i.e. function code #38 is "IOCTL_HAL_REQUEST_SYSINTR IF DeviceType == FILE_DEVICE_HAL.

    As an example, IOCTL_FLASH_READ_LOGICAL_SECTORS and IOCTL_SERIAL_SET_BREAK_ON  has the same function code (1) although the global value is different.

    If you look in %_WINCEROOT%\PUBLIC\COMMON\OAK\INC you can find the CTL_CODE #define for several devices:

    battery.h
    camera.h
    cdioctl.h
    console.h
    cs.h
    dir.txt
    diskio.h
    dsdriver.h
    dvdioctl.h
    flashmdd.h
    flashpdd.h
    intioctl.h
    ipnat.h
    mmddk.h
    mservice.h
    nmpioctl.h
    notifdev.h
    ntddip6.h
    ntddscsi.h
    pegdpar.h
    pegdser.h
    pfsioctl.h
    pkfuncs.h
    romldr.h
    romxip.h
    usbfnioctl.h
    wavedev.h
    windev.h
    wzcsapi.h

     

     


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, June 29, 2011 9:50 AM
  • Thanks for your prompt replies. I am a little bit of a newbie at this so I need to ask some more questions to completely understand

    @D.Ryan: What is PB?

    @Luca Calligaris : So different devices have different function codes right? But isn't function codes 0-2047 all reserved for Microsoft so shouldn't they be standard. Also, what I am doing right now is using virtual comports to send some signals(CD, DSR, DTS, RI) to the Windows machine from one of the ports. So basically the software simulates a pair of ports communicating serially with each other with one acting as a serial port on a Windows machine and the other as some device(for example modem).

    To be able to send those above mentioned signals to the computer from the virtual comport I would need to gain access to the Modem Control Registers and modify it.Hence, I Would need to send a control code to the port something similar to the example given here:

    http://com0com.sourceforge.net/examples/MODEM_CONTROL/tstser.cpp,

    (The virtual port I am using is downloaded from the same site)

    So as you can see here, there are two definitions(given below):

    #define IOCTL_SERIAL_GET_MODEM_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,37,METHOD_BUFFERED,FILE_ANY_ACCESS)
    #define IOCTL_SERIAL_SET_MODEM_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,38,METHOD_BUFFERED,FILE_ANY_ACCESS)

    I am confused about what the CTL_CODE is doing here in each case. Do you think you would be able to explain this to me? Thanks for your help again much appreciated.


    Wednesday, June 29, 2011 5:45 PM
  • Update @D.Ryan - Just realized PB refers to Platform Builder. Trying to download it now thanks!
    Wednesday, June 29, 2011 5:56 PM
  • If the device driver of the virtual comport is based on the standard Windows CE serial driver libraries you can use the standard serial API EscapeCommFunction which allows you to set / clear the serial port control signals: the function is actually a wrapper which call DeviceIoControl with the appropriate IOCTL
    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Wednesday, July 6, 2011 9:24 AM