1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <windows.h>
#include <ntddk.h>

int main()
{
//    NTSTATUS s;
//    PHANDLE Handle;
//    PIO_STATUS_BLOCK Status;

    HANDLE Device;
    DWORD BytesReturned;<--- Unused variable: BytesReturned

    printf("SB Test\n");

    Device = CreateFile("\\\\.\\SndBlst", GENERIC_READ | GENERIC_WRITE,
                        FILE_SHARE_READ | FILE_SHARE_WRITE,
                        NULL,
                        OPEN_EXISTING,
                        FILE_FLAG_NO_BUFFERING,
                        NULL);

    if (Device == INVALID_HANDLE_VALUE)
    {
        printf("Device is busy or could not be found.\n");
        return -1;
    }

//    DeviceIoControl(
//        Device,
//        IOCTL_FILE_DISK_OPEN_FILE,
//        OpenFileInformation,
//        sizeof(OPEN_FILE_INFORMATION) + OpenFileInformation->FileNameLength - 1,
//        NULL
//        0,
//        &BytesReturned,
//        NULL
//        )


/*    s = IoCreateFile(Handle, GENERIC_READ | GENERIC_WRITE,
                     OBJ_KERNEL_HANDLE,
                     Status,
                     0,
                     FILE_SHARE_READ | FILE_SHARE_WRITE,
                     FILE_OPEN,
                     FILE_NON_DIRECTORY_FILE,
                     NULL,
                     0,
                     CreateFileTypeNone,
                     NULL,
                     0);
*/
}