We help IT Professionals succeed at work.

printer driver windows 32 bit 64 bit

hansini21
hansini21 asked
on
Hi,
What all changes are required in a printer driver code working on 32 bit  computer and to make it work on 64 bit computer.
Please help.


Comment
Watch Question

James MurrellProduct Specialist

Commented:
what printer
Printer drivers are generally coded and maintained/updated by the printer manufacturer, and made available for download on the manufacturer's web site.  I suggest that you go to the manufacturer's web site and check for the upgraded 64 bit driver for your printer.

If you are not sure what is causing your printer problem,  have a look at the following links for windows printer problem troubleshooters:

http://windows.microsoft.com/en-us/windows-vista/Troubleshoot-printer-problems 
http://windows.microsoft.com/en-us/windows/help/printer-problems-in-windows

Author

Commented:
how to compile driver code on windows ddk.I mean what is the command etc..
James MurrellProduct Specialist

Commented:

Author

Commented:
Hi,

I am trying to install a printer driver on windows7 64 bit m/c and it is crashing if driver is installed and accessed.crash dump is here:


Loading Dump File [C:\LS8EDriver\dump\062210-74084-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path.           *
* Use .symfix to have the debugger choose a symbol path.                   *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is:
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
*                                                                   *
* The Symbol Path can be set by:                                    *
*   using the _NT_SYMBOL_PATH environment variable.                 *
*   using the -y <symbol_path> argument when starting the debugger. *
*   using .sympath and .sympath+                                    *
*********************************************************************
Unable to load image ntoskrnl.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntoskrnl.exe
*** ERROR: Module load completed but symbols could not be loaded for ntoskrnl.exe
Windows 7 Kernel Version 7600 MP (2 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Machine Name:
Kernel base = 0xfffff800`02e10000 PsLoadedModuleList = 0xfffff800`0304de50
Debug session time: Tue Jun 22 13:50:34.872 2010 (UTC - 5:00)
System Uptime: 0 days 0:06:53.605
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
*                                                                   *
* The Symbol Path can be set by:                                    *
*   using the _NT_SYMBOL_PATH environment variable.                 *
*   using the -y <symbol_path> argument when starting the debugger. *
*   using .sympath and .sympath+                                    *
*********************************************************************
Unable to load image ntoskrnl.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntoskrnl.exe
*** ERROR: Module load completed but symbols could not be loaded for ntoskrnl.exe
Loading Kernel Symbols
...............................................................
................................................................
...............................
Loading User Symbols
Loading unloaded module list
....
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck C9, {23b, fffff8800540c3f0, fffff9802dfc0bd0, 0}

Unable to load image ls8sys.sys, Win32 error 0n2
*** ERROR: Module load completed but symbols could not be loaded for ls8sys.sys
***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_IRP                                       ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!KPRCB                                      ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!KPRCB                                      ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_IRP                                       ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
Probably caused by : ls8sys.sys ( ls8sys+3f0 )

Followup: MachineOwner
---------

1: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
The IO manager has caught a misbehaving driver.
Arguments:
Arg1: 000000000000023b, The caller has changed the status field of an IRP it does not understand.
Arg2: fffff8800540c3f0, The address in the driver's code where the error was detected.
Arg3: fffff9802dfc0bd0, IRP address.
Arg4: 0000000000000000

Debugging Details:
------------------

***** Kernel symbols are WRONG. Please fix symbols to do analysis.

*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_IRP                                       ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!KPRCB                                      ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!KPRCB                                      ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_IRP                                       ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: nt!_KPRCB                                     ***
***                                                                   ***
*************************************************************************

ADDITIONAL_DEBUG_TEXT:  
Use '!findthebuild' command to search for the target build information.
If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols.

MODULE_NAME: ls8sys

FAULTING_MODULE: fffff80002e10000 nt

DEBUG_FLR_IMAGE_TIMESTAMP:  4b29303e

BUGCHECK_STR:  0xc9_23b

DRIVER_VERIFIER_IO_VIOLATION_TYPE:  23b

FAULTING_IP:
ls8sys+3f0
fffff880`0540c3f0 488bcd          mov     rcx,rbp

FOLLOWUP_IP:
ls8sys+3f0
fffff880`0540c3f0 488bcd          mov     rcx,rbp

IRP_ADDRESS:  fffff9802dfc0bd0

CUSTOMER_CRASH_COUNT:  1

DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT

CURRENT_IRQL:  0

LAST_CONTROL_TRANSFER:  from fffff8000330a3dc to fffff80002e80600

STACK_TEXT:  
fffff880`02fe1268 fffff800`0330a3dc : 00000000`000000c9 00000000`0000023b fffff880`0540c3f0 fffff980`2dfc0bd0 : nt+0x70600
fffff880`02fe1270 00000000`000000c9 : 00000000`0000023b fffff880`0540c3f0 fffff980`2dfc0bd0 00000000`00000000 : nt+0x4fa3dc
fffff880`02fe1278 00000000`0000023b : fffff880`0540c3f0 fffff980`2dfc0bd0 00000000`00000000 fffff800`02f3b868 : 0xc9
fffff880`02fe1280 fffff880`0540c3f0 : fffff980`2dfc0bd0 00000000`00000000 fffff800`02f3b868 00000000`0000023b : 0x23b
fffff880`02fe1288 fffff980`2dfc0bd0 : 00000000`00000000 fffff800`02f3b868 00000000`0000023b fffff800`0331447a : ls8sys+0x3f0
fffff880`02fe1290 00000000`00000000 : fffff800`02f3b868 00000000`0000023b fffff800`0331447a fffff800`033089f0 : 0xfffff980`2dfc0bd0


STACK_COMMAND:  kb

SYMBOL_STACK_INDEX:  4

SYMBOL_NAME:  ls8sys+3f0

FOLLOWUP_NAME:  MachineOwner

IMAGE_NAME:  ls8sys.sys

BUCKET_ID:  WRONG_SYMBOLS

Followup: MachineOwner
---------

1: kd> lmvm nt
start             end                 module name
fffff800`02e10000 fffff800`033ec000   nt       T (no symbols)          
    Loaded symbol image file: ntoskrnl.exe
    Image path: ntoskrnl.exe
    Image name: ntoskrnl.exe
    Timestamp:        Sat Feb 27 01:55:23 2010 (4B88CFEB)
    CheckSum:         00545094
    ImageSize:        005DC000
    Translations:     0000.04b0 0000.04e4 0409.04b0 0409.04e4
1: kd> lmvm ls8sys
start             end                 module name
fffff880`0540c000 fffff880`0540fa80   ls8sys     (no symbols)          
    Loaded symbol image file: ls8sys.sys
    Image path: ls8sys.sys
    Image name: ls8sys.sys
    Timestamp:        Wed Dec 16 13:08:46 2009 (4B29303E)
    CheckSum:         00012FB2
    ImageSize:        00003A80
    Translations:     0000.04b0 0000.04e4 0409.04b0 0409.04e4


Please suggest what can I do to make it work.

Author

Commented:
After reaing dump file ,I get this:

WARNING: Whitespace at end of path element

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\LS8EDriver\dump\062210-77080-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

WARNING: Whitespace at end of path element
Symbol search path is: SRV*c:\websymbols*http://msdl.microsoft.com/download/symbols
;C:\Symbols
Executable search path is:
Windows 7 Kernel Version 7600 MP (2 procs) Free x64
Product: WinNt, suite: TerminalServer SingleUserTS
Built by: 7600.16539.amd64fre.win7_gdr.100226-1909
Machine Name:
Kernel base = 0xfffff800`02862000 PsLoadedModuleList = 0xfffff800`02a9fe50
Debug session time: Tue Jun 22 12:19:59.039 2010 (UTC - 5:00)
System Uptime: 0 days 0:03:40.896
Loading Kernel Symbols
...............................................................
................................................................
.............................
Loading User Symbols
Loading unloaded module list
....
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck C9, {23b, fffff88006a1da9b, fffff9802785abd0, 0}

Unable to load image ls8sys.sys, Win32 error 0n2
*** ERROR: Module load completed but symbols could not be loaded for ls8sys.sys
Probably caused by : ls8sys.sys ( ls8sys+a9b )

Followup: MachineOwner
---------

0: kd> !analyze -v
*******************************************************************************
*                                                                             *
*                        Bugcheck Analysis                                    *
*                                                                             *
*******************************************************************************

DRIVER_VERIFIER_IOMANAGER_VIOLATION (c9)
The IO manager has caught a misbehaving driver.
Arguments:
Arg1: 000000000000023b, The caller has changed the status field of an IRP it does not understand.
Arg2: fffff88006a1da9b, The address in the driver's code where the error was detected.
Arg3: fffff9802785abd0, IRP address.
Arg4: 0000000000000000

Debugging Details:
------------------


BUGCHECK_STR:  0xc9_23b

DRIVER_VERIFIER_IO_VIOLATION_TYPE:  23b

FAULTING_IP:
ls8sys+a9b
fffff880`06a1da9b 89442440        mov     dword ptr [rsp+40h],eax

FOLLOWUP_IP:
ls8sys+a9b
fffff880`06a1da9b 89442440        mov     dword ptr [rsp+40h],eax

IRP_ADDRESS:  fffff9802785abd0

DEVICE_OBJECT: fffffa8007bae230

CUSTOMER_CRASH_COUNT:  1

DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT

PROCESS_NAME:  System

CURRENT_IRQL:  2

LOCK_ADDRESS:  fffff80002ad6400 -- (!locks fffff80002ad6400)

Resource @ nt!PiEngineLock (0xfffff80002ad6400)    Available

WARNING: SystemResourcesList->Flink chain invalid. Resource may be corrupted, or already deleted.


WARNING: SystemResourcesList->Blink chain invalid. Resource may be corrupted, or already deleted.

1 total locks

PNP_TRIAGE:
      Lock address  : 0xfffff80002ad6400
      Thread Count  : 0
      Thread address: 0x0000000000000000
      Thread wait   : 0x0

LAST_CONTROL_TRANSFER:  from fffff80002d5c3dc to fffff800028d2600

STACK_TEXT:  
fffff880`02fda238 fffff800`02d5c3dc : 00000000`000000c9 00000000`0000023b fffff880`06a1da9b fffff980`2785abd0 : nt!KeBugCheckEx
fffff880`02fda240 fffff800`02d6647a : fffff800`02d5a9f0 fffff880`06a1da9b fffff980`2785abd0 00000000`00000000 : nt!VerifierBugCheckIfAppropriate+0x3c
fffff880`02fda280 fffff800`02d67483 : 00000000`0000023b fffffa80`07aa5d10 fffff980`2785abd0 00000000`ffffffff : nt!ViErrorFinishReport+0xda
fffff880`02fda2d0 fffff800`02d67cef : fffffa80`07aa7600 00000000`00000005 00000000`00000003 fffff800`02d5da82 : nt!VfErrorReport1+0x63
fffff880`02fda370 fffff800`02d5c14e : fffff980`00000001 fffff880`02fda438 00000000`00000001 fffffa80`00000000 : nt!ViGenericVerifyIrpStackDownward+0x13f
fffff880`02fda3d0 fffff800`02d74b50 : fffffa80`0807bbf0 fffffa80`07aa5d10 fffff980`2785abd0 fffffa80`07aa7510 : nt!VfMajorVerifyIrpStackDownward+0xae
fffff880`02fda430 fffff800`02d74d86 : fffff800`00000000 fffffa80`00000001 fffffa80`00000000 fffff880`06a1da9b : nt!IovpCallDriver1+0x4a0
fffff880`02fda4e0 fffff800`02d78bb2 : fffff980`2785abd0 00000000`00000002 fffff980`2785abd0 fffff880`06a1ee4b : nt!VfBeforeCallDriver+0x186
fffff880`02fda540 fffff880`06a1da9b : fffff980`2785abd0 00000000`00000002 fffffa80`07bae230 fffffa80`07aef330 : nt!IovCallDriver+0x502
fffff880`02fda5a0 fffff980`2785abd0 : 00000000`00000002 fffffa80`07bae230 fffffa80`07aef330 fffff980`2785af70 : ls8sys+0xa9b
fffff880`02fda5a8 00000000`00000002 : fffffa80`07bae230 fffffa80`07aef330 fffff980`2785af70 fffff800`02d652a7 : 0xfffff980`2785abd0
fffff880`02fda5b0 fffffa80`07bae230 : fffffa80`07aef330 fffff980`2785af70 fffff800`02d652a7 fffffa80`07bae380 : 0x2
fffff880`02fda5b8 fffffa80`07aef330 : fffff980`2785af70 fffff800`02d652a7 fffffa80`07bae380 fffffa80`0807bbf0 : 0xfffffa80`07bae230
fffff880`02fda5c0 fffff980`2785af70 : fffff800`02d652a7 fffffa80`07bae380 fffffa80`0807bbf0 00000001`00000000 : 0xfffffa80`07aef330
fffff880`02fda5c8 fffff800`02d652a7 : fffffa80`07bae380 fffffa80`0807bbf0 00000001`00000000 fffffa80`07735460 : 0xfffff980`2785af70
fffff880`02fda5d0 fffff800`02d78c16 : fffffa80`07bae230 fffff980`2785abd0 fffff980`2785abd0 fffff800`02d7437e : nt!VfIrpAllocateCallDriverData+0x47
fffff880`02fda600 fffff800`02d77c42 : fffff980`2785af70 00000000`00000002 fffffa80`0801f190 fffffa80`07735460 : nt!IovCallDriver+0x566
fffff880`02fda660 fffff800`02d78c16 : fffff980`2785abd0 00000000`00000002 fffffa80`0801f040 00000000`00000000 : nt!ViFilterDispatchPower+0x62
fffff880`02fda690 fffff800`02d77d58 : fffff980`2785abd0 fffffa80`0801f040 00000000`00000000 fffffa80`0773c7f0 : nt!IovCallDriver+0x566
fffff880`02fda6f0 fffff800`02d77e42 : fffffa80`07780a00 fffffa80`0983e6a0 fffffa80`07780a00 00000000`00000017 : nt!VfIrpSendSynchronousIrp+0xe8
fffff880`02fda760 fffff800`02d64faf : fffffa80`08b769e0 00000000`000007ff fffff800`02a115b8 fffff800`02c6a4c9 : nt!VfWmiTestStartedPdoStack+0x72
fffff880`02fda800 fffff800`02986462 : fffffa80`08b769e0 00000000`00000000 00000000`00000000 00000000`00000000 : nt!VfMajorTestStartedPdoStack+0x5f
fffff880`02fda830 fffff800`02cbddac : fffffa80`08b769e0 fffffa80`0983e6a0 00000000`00000001 ffffffff`80000dd0 : nt!PpvUtilTestStartedPdoStack+0x12
fffff880`02fda860 fffff800`02cbf9a4 : fffffa80`08b769e0 fffffa80`08b769e0 fffffa80`0983e6a0 00000000`00000001 : nt!PipProcessStartPhase3+0x55c
fffff880`02fda950 fffff800`02cbff68 : fffff800`02ad3d80 00000000`00000000 00000000`00000010 fffff800`02cbfed0 : nt!PipProcessDevNodeTree+0x264
fffff880`02fdabc0 fffff800`029d42f7 : 00000001`00000003 00000000`00000000 00000000`00000001 00000000`00000000 : nt!PiProcessReenumeration+0x98
fffff880`02fdac10 fffff800`028df861 : fffff800`029d3fd0 fffff800`02bcf801 fffffa80`06bfc600 fffffa80`06bfc680 : nt!PnpDeviceActionWorker+0x327
fffff880`02fdacb0 fffff800`02b77a86 : 00000000`00000000 fffffa80`06bfc680 00000000`00000080 fffffa80`06b425f0 : nt!ExpWorkerThread+0x111
fffff880`02fdad40 fffff800`028b0b06 : fffff880`009ed180 fffffa80`06bfc680 fffff880`009f7f40 00000000`00000000 : nt!PspSystemThreadStartup+0x5a
fffff880`02fdad80 00000000`00000000 : fffff880`02fdb000 fffff880`02fd5000 fffff880`02fd9ed0 00000000`00000000 : nt!KxStartSystemThread+0x16


STACK_COMMAND:  kb

SYMBOL_STACK_INDEX:  9

SYMBOL_NAME:  ls8sys+a9b

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: ls8sys

IMAGE_NAME:  ls8sys.sys

DEBUG_FLR_IMAGE_TIMESTAMP:  4c1a36ad

FAILURE_BUCKET_ID:  X64_0xc9_23b_ls8sys+a9b

BUCKET_ID:  X64_0xc9_23b_ls8sys+a9b

Followup: MachineOwner
---------

Please help

Author

Commented:
Hi Guys,

I have this file compatible on 32 bit computer nnow I want to make it work on 64 bit computer.Please suggest changes required.

 Defines the entry point for the DLL application.
//

#include "stdafx.h"


#include <setupapi.h>
#include <objbase.h>
#include <initguid.h>


#include <fstream.h>
#include <sstream>

#define PAYLOAD_SIZE 16
typedef struct _VENDOR_PACKET
{
      UCHAR bRequest;
      USHORT wValue;
      USHORT wIndex;
      USHORT wLength;
      UCHAR  data[PAYLOAD_SIZE];
} VENDOR_PACKET, * PVENDOR_PACKET;

/*
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                               )
{
    switch (ul_reason_for_call)
      {
            case DLL_PROCESS_ATTACH:
            case DLL_THREAD_ATTACH:
            case DLL_THREAD_DETACH:
            case DLL_PROCESS_DETACH:
                  break;
    }
    return TRUE;
}

*/

// This is the constructor of a class that has been exported.
// see LS8_Sys_API.h for the class definition
CLS8_Sys_API::
CLS8_Sys_API() :
    m_DeviceHandle(NULL),
    m_ErrorString(""),
    m_Error(false),
    m_DevicePath(""),
    m_ChunkSize(16),
    m_InPipe ("PIPE00"),
    m_OutPipe("PIPE01")
{
    //m_DeviceHandle = HANDLE(new uint32_t (0));    //For debug w/o the driver

   m_DeviceHandle = GetDeviceHandle();             //Normal
      return;
}

CLS8_Sys_API::
~CLS8_Sys_API()
{
    if (m_DeviceHandle!=NULL)
    {
        CloseHandle(m_DeviceHandle);
        m_DeviceHandle = NULL;
    }
}

string
CLS8_Sys_API::
GetError()
{
    if (m_Error)
    {
        m_Error = false;
        return m_ErrorString;
    }
    return "";
}


bool
CLS8_Sys_API::
GetVersion(VERSION *version)
{
   UINT success = 0x00;
   ULONG BytesReturned = 0x00;

   if (m_DeviceHandle == INVALID_HANDLE_VALUE) {
        m_Error = true;
        m_ErrorString = "Device Handle was Invalid";
        return FALSE;
    }
   
    success = DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VERSION,
                    NULL,0,
                    version, sizeof(*version),
                    &BytesReturned,
                    NULL);
    if (!success)
    {
        m_Error = true;
        m_ErrorString = "Unable To Get Driver Version";
            return FALSE;
    }
    return TRUE;
}

void
CLS8_Sys_API::
GiveFirmware(string fileName, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{

    ifstream *in = new ifstream(fileName.c_str(),ios::in|ios::binary|ios::ate|ios::nocreate);
    if (!in->is_open())
    {
        m_Error = true;
        m_ErrorString = "Invalid file name:" +fileName;
        return;
    }
    //Get the file size:
    uint32_t size = in->tellg();
    //Go back to the begining of the file
    in->seekg(0);

    //Yes we are Loading the whole thing into memory :)
    uint8_t *data = new uint8_t[size];
    if (data==NULL)
    {
        m_Error = true;
        m_ErrorString = "Unable to Allocate:";
        std::ostringstream sstr;
        sstr << size;
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Bytes";
        return;
    }
    uint8_t *ptr = data;
    int retd = 1;
    for(int i=0;i<size && retd!=0;)
    {
        in->read((char*)ptr,m_ChunkSize);
        retd = in->gcount();
        ptr+=retd;
        i+=retd;
    }
    in->close();
    SendGiveFirmwareCommand(size);
    if (m_Error) return;

    SendBulkData(data, size, progressCallback);
}


void
CLS8_Sys_API::
GiveFile(uint8_t type, uint8_t index, string fileName, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{
    uint16_t FileTransferStatus;
    SYSTEMTIME Present;
    WORD TimeoutPeriodStart;
    WORD TimeoutPeriodEnd;

    ifstream *in = new ifstream(fileName.c_str(),ios::in|ios::binary|ios::ate|ios::nocreate);
    if (!in->is_open())
    {
        m_Error = true;
        m_ErrorString = "Invalid file name:" +fileName;
        return;
    }
    //Get the file size:
    uint32_t size = in->tellg();
    //Go back to the begining of the file
    in->seekg(0);

    //Yes we are Loading the whole thing into memory :)
    uint8_t *data = new uint8_t[size];
    if (data==NULL)
    {
        m_Error = true;
        m_ErrorString = "Unable to Allocate: ";
        std::ostringstream sstr;
        sstr << size;
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Bytes";
        return;
    }
    uint8_t *ptr = data;
    int retd = 1;
    for(int i=0;i<size && retd!=0;)
    {
        in->read((char*)ptr,m_ChunkSize);
        retd = in->gcount();
        ptr+=retd;
        i+=retd;
    }
    in->close();
    SendGiveFileCommand(type, index, size);
    if (m_Error) return;
    SendBulkData(data, size, progressCallback);

    GetSystemTime(&Present);
    TimeoutPeriodStart = Present.wSecond;
    TimeoutPeriodEnd = (TimeoutPeriodStart + 20) % 60;
    do{
        GetSystemTime(&Present);

        if( TimeoutPeriodEnd > TimeoutPeriodStart && Present.wSecond > TimeoutPeriodEnd
         || TimeoutPeriodEnd < TimeoutPeriodStart && Present.wSecond > TimeoutPeriodEnd && Present.wSecond < TimeoutPeriodStart )
        {
            m_Error = true;
            m_ErrorString = "Upload Timeout";
            return;
        }

        GetFileStatus(&FileTransferStatus);

        if( ((uint16_t)0x02 & FileTransferStatus) )
        {
            m_Error = true;
            m_ErrorString = "File Upload Error";
            return;
        }
    }while( ((uint16_t)0x01 & FileTransferStatus) );
}

void
CLS8_Sys_API::
SendBulkData(uint8_t *data, uint32_t size, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{
      
      COMMTIMEOUTS cto;

      HANDLE bulkH = OpenPipe(m_OutPipe);
    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Bulk Pipe not open";
        return;
    }
      if (size==0)
    {
            m_Error = true;
            m_ErrorString = "No Point sending 0 bytes";
            return;
    }
      
      //Set DCB
      //GetCommState(bulkH, &dcbConfig);
      //SetCommState(bulkH, &dcbConfig);

      //set comm timeouts
      GetCommTimeouts(bulkH,&cto);
   
      cto.ReadIntervalTimeout = 0;
      cto.ReadTotalTimeoutConstant = 0;
      cto.ReadTotalTimeoutMultiplier = 0;
      cto.WriteTotalTimeoutConstant = 5000;
      cto.WriteTotalTimeoutMultiplier = 0;
      
      SetCommTimeouts(bulkH, &cto);

    //int i=0;
    uint32_t retdSize = 1;
      uint32_t bytesRemaining = size;
      //initialize progress
      if(progressCallback)
      {
            progressCallback(0, size);
      }
    while(bytesRemaining > 0 && retdSize != 0)
    {
        WriteFile(
                        bulkH,
            data,
            ((bytesRemaining / m_ChunkSize) ? m_ChunkSize : bytesRemaining),
            &retdSize,
            NULL);

                if(retdSize < ((bytesRemaining / m_ChunkSize) ? m_ChunkSize : bytesRemaining))
                {
              /*
          m_Error = true;
          m_ErrorString = "Only Sent ";
          std::ostringstream sstr;
          sstr <<retdSize;
          m_ErrorString+= sstr.str();
          m_ErrorString+=" of ";
          sstr <<((bytesRemaining / m_ChunkSize) ? m_ChunkSize : bytesRemaining);
          m_ErrorString+= sstr.str();
          m_ErrorString+=" Bytes";
          */
                      return;
                }

                bytesRemaining-=retdSize;
               
                data+=retdSize;
                if(progressCallback)
                {
                      progressCallback(size - bytesRemaining, size);
                }
      }
      
      if (bytesRemaining > 0)
    {
        m_Error = true;
        m_ErrorString = "Write Failed, ";
        std::ostringstream sstr;
        sstr <<bytesRemaining;
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Bytes Remaining";
    }
    CloseHandle(bulkH);
}



void
CLS8_Sys_API::
ReceiveBulkData(uint8_t *data, uint32_t size, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{
      
    COMMTIMEOUTS cto;

      HANDLE bulkH = OpenPipe(m_InPipe);
      
    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
            m_Error = true;
        m_ErrorString = "Bulk Pipe not open";
        return;
    }
      
      if (size==0)
    {
            m_Error = true;
            m_ErrorString = "No Point recieving 0 bytes";
            return;
    }

      //set comm timeouts
      GetCommTimeouts(bulkH,&cto);
   
      cto.ReadIntervalTimeout = MAXDWORD;
      cto.ReadTotalTimeoutConstant = 5000;
      cto.ReadTotalTimeoutMultiplier = MAXDWORD;
      cto.WriteTotalTimeoutConstant = 0;
      cto.WriteTotalTimeoutMultiplier = 0;
      
      SetCommTimeouts(bulkH, &cto);

    //int i=0;
    uint32_t retdSize = 1;
      uint32_t bytesRemaining = size;
      //initialize progress
      if(progressCallback)
      {
            progressCallback(0, size);
      }
    while(bytesRemaining > 0 && retdSize != 0)
    {
        ReadFile(
                  bulkH,
            data,
            ((bytesRemaining / m_ChunkSize) ? m_ChunkSize : bytesRemaining),
            &retdSize,
            NULL);
             
            if (retdSize < ((bytesRemaining / m_ChunkSize) ? m_ChunkSize : bytesRemaining))
            {
                  retdSize = 0;
            }
        bytesRemaining -= retdSize;
        data+=retdSize;
            if(progressCallback)
            {
                  progressCallback(size - bytesRemaining, size);
            }
    }
      
      if (bytesRemaining > 0)
    {
        m_Error = true;
        m_ErrorString = "Read Failed, ";
        std::ostringstream sstr;
        sstr <<bytesRemaining;
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Bytes Remaining";
    }
    CloseHandle(bulkH);
}


void
CLS8_Sys_API::
SendGiveFirmwareCommand(uint32_t sizeOfUpgrade)
{
    UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;

      Packet.bRequest = LS8_GIVE_FIRMWARE;
      Packet.wIndex = 0x0000;
      Packet.wValue = 0x0000;
      Packet.wLength = sizeof(sizeOfUpgrade);
      *((uint32_t *)Packet.data) = sizeOfUpgrade;

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return;
    }

    if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_WRITE,
                    &Packet,
                    sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    NULL,
                    0,
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Start Upgrade Command";
        return;
    }

}

void
CLS8_Sys_API::
SendGiveFileCommand(uint8_t type, uint8_t index, uint32_t sizeOfFile)
{
    UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;

      Packet.bRequest = LS8_GIVE_FILE;
      Packet.wIndex = (uint16_t)(index);
      Packet.wValue = (uint16_t)(type);
      Packet.wLength = sizeof(sizeOfFile);
      *((uint32_t *)(Packet.data)) = sizeOfFile;

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_WRITE,
                    &Packet,
                    sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    NULL,
                    0,
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Give File Command";
        return;
    }

}

HANDLE
CLS8_Sys_API::
GetDeviceHandle()
{
    DWORD instance = 0;
      // Get handle to relevant device information set
      HDEVINFO info = SetupDiGetClassDevs((LPGUID)&GUID_CLASS_LS8_SYS, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
      if(info==INVALID_HANDLE_VALUE)
      {
        m_Error = true;
        m_ErrorString = "Invalid GUID/CLASS";
            return NULL;
      }

      // Get interface data for the requested instance
      SP_INTERFACE_DEVICE_DATA ifdata;
      ifdata.cbSize = sizeof(ifdata);
      if(!SetupDiEnumDeviceInterfaces(info, NULL, (LPGUID)&GUID_CLASS_LS8_SYS, instance, &ifdata))
      {
            SetupDiDestroyDeviceInfoList(info);
        m_Error = true;
        m_ErrorString = "Invalid Device Instance";
            return NULL;
      }

      // Get size of symbolic link name
      DWORD ReqLen;
      SetupDiGetDeviceInterfaceDetail(info, &ifdata, NULL, 0, &ReqLen, NULL);
      PSP_INTERFACE_DEVICE_DETAIL_DATA ifDetail = (PSP_INTERFACE_DEVICE_DETAIL_DATA)(new char[ReqLen]);
      if( ifDetail==NULL)
      {
            SetupDiDestroyDeviceInfoList(info);
        m_Error = true;
        m_ErrorString = "Unable to obtain Symbolic Link Name String Length";
            return NULL;
      }

      // Get symbolic link name
      ifDetail->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
      if( !SetupDiGetDeviceInterfaceDetail(info, &ifdata, ifDetail, ReqLen, NULL, NULL))
      {
            SetupDiDestroyDeviceInfoList(info);
            delete ifDetail;
        m_Error = true;
        m_ErrorString = "Unable to obtain Symbolic Link Name";
            return NULL;
      }
    else
    {
        //Store the Device Path for easy access later whenc reating pipe handles.
        this->m_DevicePath = ifDetail->DevicePath;
    }

      // Open file
      HANDLE rv = CreateFile( ifDetail->DevicePath,
            GENERIC_READ | GENERIC_WRITE,
            FILE_SHARE_READ | FILE_SHARE_WRITE,
            NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
      if( rv==INVALID_HANDLE_VALUE)
    {
        rv = NULL;
        m_Error = true;
        m_ErrorString = "Invalid Device Handle Created";
    }

      delete ifDetail;
      SetupDiDestroyDeviceInfoList(info);
      return rv;
}

HANDLE
CLS8_Sys_API::
OpenPipe( string pipeName)
{
    HANDLE h;

    if (m_DevicePath=="")
    {
        m_Error = true;
        m_ErrorString = "Device improperly Initialized";
        return INVALID_HANDLE_VALUE;
    }
    string completeName =  m_DevicePath+"\\"+pipeName;
     
    //printf("completeDeviceName = (%s)\n", completeDeviceName);
      
      h = CreateFile(completeName.c_str(),
                  GENERIC_WRITE | GENERIC_READ,
                  FILE_SHARE_WRITE | FILE_SHARE_READ,
                  0,
                  OPEN_EXISTING,
                  0,
                  0);


    if (h == INVALID_HANDLE_VALUE)
    {
            m_ErrorString = "Failed to open ("+completeName+") = ";
            m_ErrorString+= GetLastError();
            m_Error = true;
       
    }
 

    return h;
}

void
CLS8_Sys_API::
GetFirmware(string fileName, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{

    ofstream out(fileName.c_str(),ios::out|ios::binary);

    if (!out.is_open())
    {
        m_Error = true;
        m_ErrorString = "Invalid file name:" +fileName;
        return;
    }

    uint32_t firmwareSize = SendGetFirmwareCommand();

    if (m_Error)
    {
        out.close();
        return;
    }

    uint8_t *data = new uint8_t[firmwareSize];
    ReceiveBulkData(data, firmwareSize, progressCallback);

    if (m_Error)
    {
            delete [] data;
        out.close();
        return;
    }

    out.write((const char *)data, firmwareSize);
    delete [] data;
    out.close();
}

void
CLS8_Sys_API::
GetFile(uint8_t type, uint8_t index, string fileName, void (*progressCallback)(uint32_t bytesUploaded, uint32_t bytesTotal))
{
    uint16_t FileTransferStatus;
    SYSTEMTIME Present;
    WORD TimeoutPeriodStart;
    WORD TimeoutPeriodEnd;

    ofstream out(fileName.c_str(),ios::out|ios::binary);

    if (!out.is_open())
    {
        m_Error = true;
        m_ErrorString = "Invalid file name:" +fileName;
        return;
    }

    uint32_t fileSize = SendGetFileCommand(type, index);

    if (m_Error)
    {
        out.close();
        return;
    }

    uint8_t *data = new uint8_t[fileSize];
    ReceiveBulkData(data, fileSize, progressCallback);

    GetSystemTime(&Present);
    TimeoutPeriodStart = Present.wSecond;
    TimeoutPeriodEnd = (TimeoutPeriodStart + 20) % 60;
    do{
        GetSystemTime(&Present);

        if( TimeoutPeriodEnd > TimeoutPeriodStart && Present.wSecond > TimeoutPeriodEnd
         || TimeoutPeriodEnd < TimeoutPeriodStart && Present.wSecond > TimeoutPeriodEnd && Present.wSecond < TimeoutPeriodStart )
        {
            m_Error = true;
            m_ErrorString = "Download Timeout";
            break;
        }

        GetFileStatus(&FileTransferStatus);

        if( ((uint16_t)0x08 & FileTransferStatus) )
        {
            m_Error = true;
            m_ErrorString = "File Download Error";
            break;
        }
    }while( ((uint16_t)0x04 & FileTransferStatus) );

    if (m_Error)
    {
        out.close();
        return;
    }

    out.write((const char *)data, fileSize);
    delete [] data;
    out.close();
}

uint32_t
CLS8_Sys_API::
SendGetFirmwareCommand()
{
    UINT success = 0x00;
    ULONG BytesReturned = 0x00;
    uint32_t size = 0;
      VENDOR_PACKET Packet;
      Packet.bRequest = LS8_GET_FIRMWARE;
      Packet.wIndex = 0x0000;
      Packet.wValue = 0x0000;
      Packet.wLength = sizeof(size);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return size;
    }

    if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet,
                    sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    &size,
                    sizeof(size),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Start Firmware Download Command";
        return size;

    }

    if (BytesReturned!=sizeof(size))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Firmware Download Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(size);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << size;
        m_ErrorString+= sstr2.str();

        return size;
    }

    return size;
}


uint32_t
CLS8_Sys_API::
SendGetFileCommand(uint8_t type, uint8_t index)
{
    UINT success = 0x00;
    ULONG BytesReturned = 0x00;
    uint32_t size = 0;
      VENDOR_PACKET Packet;
      Packet.bRequest = LS8_GET_FILE;
      Packet.wIndex = (uint16_t)(index);
      Packet.wValue = (uint16_t)(type);
      Packet.wLength = sizeof(size);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return size;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet,
                    sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    &size,
                    sizeof(size),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Command";
        return size;

    }

    if (BytesReturned!=sizeof(size))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(size);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << size;
        m_ErrorString+= sstr2.str();

        return size;
    }

    return size;
}

bool
CLS8_Sys_API::
GetFileTypes(FILE_TYPES *file_types)
{
       UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;
      
      Packet.bRequest = LS8_GET_FILE_TYPES;
      Packet.wIndex = 0x00;
      Packet.wValue = 0x00;
      Packet.wLength = sizeof(*file_types);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return FALSE;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet, sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    file_types, sizeof(*file_types),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Types Command";
        return FALSE;

    }

    if (BytesReturned!=sizeof(*file_types))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Types Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(*file_types);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << BytesReturned;
        m_ErrorString+= sstr2.str();

        return FALSE;
    }


    return TRUE;
}

bool
CLS8_Sys_API::
GetFileMax(FILE_TYPES file_type, FILE_NUM *num_files)
{
      UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;
      
      Packet.bRequest = LS8_GET_FILE_MAX;
      Packet.wIndex = 0x00;
      Packet.wValue = file_type;
      Packet.wLength = sizeof(*num_files);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return FALSE;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet,sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    num_files, sizeof(*num_files),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Types Command";
        return FALSE;

    }

    if (BytesReturned!=sizeof(*num_files))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Max Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(*num_files);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << BytesReturned;
        m_ErrorString+= sstr2.str();

        return FALSE;
    }

    return TRUE;
}

bool
CLS8_Sys_API::
GetFileAttributes(FILE_TYPES file_type, FILE_NUM file_num, LS8_FILE_ATTRIBUTES *ls8_file_attr)
{
      UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;
      
      Packet.bRequest = LS8_GET_FILE_ATTRIBUTES;
      Packet.wIndex = file_num;
      Packet.wValue = file_type;
      Packet.wLength = sizeof(*ls8_file_attr);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return FALSE;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet, sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    ls8_file_attr,sizeof(*ls8_file_attr),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Attributes Command";
        return FALSE;

    }

    if (BytesReturned!=sizeof(*ls8_file_attr))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Max Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(*ls8_file_attr);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << BytesReturned;
        m_ErrorString+= sstr2.str();

        return FALSE;
    }

    return TRUE;
}

bool
CLS8_Sys_API::
GetFileTypeAttributes(FILE_TYPES file_type, LS8_FILE_TYPE_ATTRIBUTES *ls8_type_attr)
{
      UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;
      
      Packet.bRequest = LS8_GET_FILE_TYPE_ATTRIBUTES;
      Packet.wIndex = 0x0000;
      Packet.wValue = file_type;
      Packet.wLength = sizeof(*ls8_type_attr);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return FALSE;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet, sizeof(Packet) - PAYLOAD_SIZE+Packet.wLength,
                    ls8_type_attr,sizeof(*ls8_type_attr),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Attributes Command";
        return FALSE;

    }

    if (BytesReturned!=sizeof(*ls8_type_attr))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Max Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(*ls8_type_attr);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << BytesReturned;
        m_ErrorString+= sstr2.str();

        return FALSE;
    }

    return TRUE;
}

bool
CLS8_Sys_API::
GetFileStatus(uint16_t * status)
{
      UINT success = 0x00;
    ULONG BytesReturned = 0x00;
      VENDOR_PACKET Packet;
      
      Packet.bRequest = LS8_GET_FILE_STATUS;
      Packet.wIndex = 0x00;
      Packet.wValue = 0x00;
      Packet.wLength = sizeof(*status);

    if (m_DeviceHandle == INVALID_HANDLE_VALUE)
    {
        m_Error = true;
        m_ErrorString = "Device not open";
        return FALSE;
    }

    /** @todo Pass type and index */
      if (!DeviceIoControl(m_DeviceHandle,
                    IOCTL_LS8SYS_VENDOR_READ,
                    &Packet,sizeof(Packet) - PAYLOAD_SIZE + Packet.wLength,
                    status, sizeof(*status),
                    &BytesReturned,
                    NULL))
    {
        m_Error = true;
        m_ErrorString = "Device Failed To Send Get File Status Command";
        return FALSE;

    }

    if (BytesReturned!=sizeof(*status))
    {
        m_Error = true;
        m_ErrorString = "Invalid Data Size Return from Get File Status Expected: ";
                std::ostringstream sstr;
        sstr << sizeof(*status);
        m_ErrorString+= sstr.str();
        m_ErrorString+=" Got: ";
        std::ostringstream sstr2;
        sstr2 << BytesReturned;
        m_ErrorString+= sstr2.str();

        return FALSE;
    }

    return TRUE;
}


///////////
//EOF
///////////