mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
976 B
52 lines
976 B
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include "windows.h"
|
|
|
|
#define FAILURE(e) printf("FAIL: %d/%d\n",e,__LINE__);exit(1)
|
|
|
|
int __cdecl main(int argc,char *argv[]) {
|
|
|
|
HANDLE hFile;
|
|
DWORD junk;
|
|
char *myPort = "COM1";
|
|
|
|
if (argc > 1) {
|
|
|
|
myPort = argv[1];
|
|
|
|
}
|
|
|
|
if ((hFile = CreateFile(
|
|
myPort,
|
|
GENERIC_READ | GENERIC_WRITE,
|
|
0,
|
|
NULL,
|
|
CREATE_ALWAYS,
|
|
FILE_ATTRIBUTE_NORMAL,
|
|
NULL
|
|
)) != ((HANDLE)-1)) {
|
|
|
|
if (!DeviceIoControl(
|
|
hFile,
|
|
0x001b004c,
|
|
NULL,
|
|
0,
|
|
NULL,
|
|
0,
|
|
&junk,
|
|
NULL
|
|
)) {
|
|
|
|
FAILURE(GetLastError());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FAILURE(GetLastError());
|
|
|
|
}
|
|
|
|
}
|