- 博客(131)
- 收藏
- 关注
原创 QWaitCondition处理Qt中生产者消费者模型
static const int DataSize = 100;static const int BufferSize = 10;static int buffer[BufferSize];static QWaitCondition bufferEmpty; // 缓冲区有空位条件static QWaitCondition bufferFull; // 缓冲区有可用数据static QMutex mutex;static int numUsedBytes = 0; // 可用字节
2022-05-28 13:27:39
183
原创 QSemphore处理生产者/消费者问题
const int DataSize = 100;const int BufferSize = 10;char buffer[BufferSize];QSemaphore freeSpace(BufferSize); // 空闲空间QSemaphore usedSpace(0); // 已用空间class Producer : public QThread // 生产者线程{protected: void run() { qsra
2022-05-28 11:03:11
243
1
原创 socket入门之TCP服务端
#include <stdio.h>#ifdef WIN32#include <WinSock2.h>#include <Windows.h>#else#include <sys/types.h>#include <sys/socket.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <str
2022-05-09 13:22:39
647
原创 socket编程入门-(第一课)跨windows和linux
#include <stdio.h>#ifdef WIN32#include <WinSock2.h>#include <Windows.h>#else#include <sys/types.h>#include <sys/socket.h>#include <unistd.h>#endif#ifdef WIN32#pragma comment(lib, "ws2_32.lib")#endifint mai
2022-05-08 11:28:21
372
原创 十大经典排序(上)
#include <stdio.h>// 冒泡排序void bubbleSort(int *array, int len);// 选择排序void selectSort(int *array, int len);// 插入排序void insertSort(int *array, int len);// 希尔排序void shellSort(int *array, int len);// 归并排序之子合并int* merge(int *left, int len1,
2022-05-07 22:56:55
75
原创 Windows线程池(一)-基本工作项
#include <Windows.h>#include <stdio.h>VOID NTAPI SimpleCallback(PTP_CALLBACK_INSTANCE Instance, PVOID Context){ char* str = (char*)Context; printf("Hello %s\n", str);}VOID NTAPI WorkCallback(PTP_CALLBACK_INSTANCE Instance, PVOID Contex
2022-05-04 10:13:34
397
原创 分层驱动之循环读数据
// driverA.c#include <ntddk.h>// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject){ UNICODE_STRING DevSymboliclinkName = { 0 }; RtlInitUnicodeString(&DevSymboliclinkName, L"\\??\\LayerDriver"); IoDeleteSymbolicLink(&DevSymbolicl
2022-05-03 16:31:21
313
原创 处理IRP的几种方式
// driver.c#include <ntddk.h>typedef struct _DEVICE_EXTENSION{ PDEVICE_OBJECT AttachDevice; // ...} DEVICE_EXTENSION, *PDEVICE_EXTENSION;// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject){ KdPrint(("驱动卸载\n")); UNREFERENCED_PARAM.
2022-04-30 22:46:49
376
原创 枚举指定驱动对象和设备对象
// driver.c#include <ntifs.h>#include <ntddk.h>extern POBJECT_TYPE* IoDriverObjectType;NTSTATUSObReferenceObjectByName( __in PUNICODE_STRING ObjectName, __in ULONG Attributes, __in_opt PACCESS_STATE AccessState, __in_opt ACCESS_MASK
2022-04-29 09:16:13
369
原创 IoAllocateIrp用于驱动调用驱动
// driver.c#include <ntddk.h>// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject){ KdPrint(("驱动卸载\n")); UNREFERENCED_PARAMETER(pDriverObject);}// 测试函数VOID CallDriverTest(){ NTSTATUS status = STATUS_SUCCESS; PFILE_OBJECT pFileObj =
2022-04-28 11:44:06
359
原创 使用设备对象指针来进行驱动调用驱动
// dest#include <ntddk.h>// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject){ KdPrint(("驱动卸载\n")); UNREFERENCED_PARAMETER(pDriverObject); UNICODE_STRING DevSymbolicLinkName = { 0 }; RtlInitUnicodeString(&DevSymbolicLinkName, L"\\?
2022-04-28 10:29:46
165
原创 使用ZwCreateFile进行驱动调用驱动
// 目标驱动#include <ntddk.h>// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject){ UNICODE_STRING DevSymbolicLink = { 0 }; KdPrint(("驱动卸载\n")); UNREFERENCED_PARAMETER(pDriverObject); RtlInitUnicodeString(&DevSymbolicLink, L"\\??\\Driv
2022-04-28 09:35:10
738
原创 内核时间处理相关函数
#include <ntddk.h>// 卸载函数VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject);// 时间函数测试VOID TimeTest();// 入口函数NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath){ NTSTATUS status = STATUS_SUCCESS; KdPri
2022-04-27 10:58:39
173
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人