CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Posts
    1

    Angry Inline Assembly in a Driver for Hard Drive IO

    I have several questions:

    1. Are "major functions" (DriverObject->MajorFunction[IRP_MJ_XXX]), which are attached to device object on the init step, being executed in kernel-mode? In other words, can I expect that all the code inside these functions will be executed in the kernel-mode?

    2. If #1 = yes, then I would like to know if it is possible to use inline assembly with, for instance, 13h interruption and many others (which are restricted in user-mode) inside those major functions?

    3. If #2 = yes, then could you reference me some useful links/sources/books where I can learn how to read/write physical Hard Drive within LBA-style, using this inline assembly?

    In case if you are curious: I don't like that "CreateFile("\\\\.\\PhysicalDriveX",...)" functions requires administrator rights...

  2. #2
    Join Date
    May 2000
    Location
    Armenia
    Posts
    201

    Re: Inline Assembly in a Driver for Hard Drive IO

    1. Most probably the answer would be "yes", if the driver is kernel
    mode driver.

    2. The usage of inline assembly is not dependent from particular function or
    interrupt. It only requires the compiler to support "inline assembly".
    So if I correctly understood your question, the answer would be "yes" it is
    possible to use inline assembly in kernel code (as well in user mode
    code).

    3. I just want to warn you, that if your driver is going to be used also on
    64-bit platforms, then inline assembly should not be a choice since Visual
    Studio doesn't support inline assembly for 64-bit compilation.

    In case if you are curious: I don't like that "CreateFile("\\\\.\\PhysicalDriveX",...)" functions requires administrator rights...
    Is this the only reason why you decided to use kernel mode driver and inline assembly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured