freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

windows982000驅動程序編寫方法(編輯修改稿)

2025-08-13 18:54 本頁面
 

【文章內容簡介】 void doRead(int n) // 從驅動程序中讀數(shù)據 { char *buf。 ULONG nRead。 int i, j。 buf = (char *) malloc(n)。 if (buf == NULL) { printf(Failed to allocate buffer for read)。 Exit(1)。 } // Read data from driver printf(Reading from device )。 ReadFile(hDevice, buf, n, amp。nRead, NULL)。 // 參數(shù)分別是設備句柄、輸入緩沖地址、緩沖大小(字節(jié)數(shù))、實際讀的數(shù)據字節(jié)數(shù)、覆蓋結構指針。 現(xiàn)代微機原理與接口技術 41 printf(%d bytes read from device (%d requested).\n, nRead, nRead)。 // Print what was read while(i nRead) { // j = min((i+26),n)。 // for(。 i j。 i++) // { // printf(%c, , buf[i])。 // } // printf(\n)。 printf(%c, ,buf[i++])。 } printf(\n)。 free(buf)。 } 這幾句刪除 現(xiàn)代微機原理與接口技術 42 void doWrite(int n) // 向驅動程序中寫數(shù)據 { char *buf。 ULONG nWritten。 int i, j。 buf = (char *) malloc(n)。 if (buf == NULL) { printf(Failed to allocate buffer for write)。 Exit(1)。 } // start with the mod26 letter of the number of bytes to write j = (n % 26)。 // load buffer with dummy data (abcdefg...) for (i=0。 in。 i++, j=(j + 1)%26) { buf[i] = 39。a39。 + j。 } 現(xiàn)代微機原理與接口技術 43 // Write data to driver printf(Writing to device )。 WriteFile(hDevice, buf, n, amp。nWritten, NULL)。 // 寫數(shù)據 ,參數(shù)的含義是驅動程序句柄、寫緩沖、寫緩沖大小、實際驅動程序得到的信息的字節(jié)數(shù)、覆蓋結構指針。 printf(%d bytes written to device (%d attempted).\n, nWritten, n)。 i = 0。 // Print what was written while(i n) { j = min((i+26),n)。 for(。 i j。 i++) { printf(%c, , buf[i])。 } printf(\n)。 } free(buf)。 } 現(xiàn)代微機原理與接口技術 44 b. 使用 IO控制代碼方式分別讀寫 NTSTATUS SampleDevice::SAMPLE_IOCTL_Read_Handler(KIrp I) { // 對應用程序讀驅動程序的請求作響應 NTSTATUS status = STATUS_SUCCESS。 t Entering SampleDevice::SAMPLE_IOCTL_Read_Handler, I EOL。 char buff1[512]。 ULONG fwLength=0。 strcpy(buff1,Wele to driver!)。 fwLength = strlen(buff1)+1。 if (() = fwLength) {// 如果讀入緩沖夠長 strcpy((PCHAR)(),buff1)。 // 將信息拷給應用程序讀入緩沖 () = fwLength。 // 返回信息長度 } else { () = 0。 // 否則信息長度為 0 t buff size too small EOL。 } return status。 } 現(xiàn)代微機原理與接口技術 45 NTSTATUS SampleDevice::SAMPLE_IOCTL_Write_Handler(KIrp I) { // 接受從應用程序中來的信息 NTSTATUS status = STATUS_SUCCESS。 t Entering SampleDevice :: SAMPLE_IOCTL_Write_Handler , I EOL。 char buff[512]。 ULONG fwLength=0。 strcpy(buff,(PCHAR)())。 // 拷貝從應用程序得到的命令串到驅動程序局部
點擊復制文檔內容
環(huán)評公示相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1