阅读:3732回复:8
求教HalMakeBeep如何用,有分相送。
ntddk.h里是这么定义的:
// // System beep functions. // #if !defined(NO_LEGACY_DRIVERS) NTHALAPI BOOLEAN HalMakeBeep( IN ULONG Frequency ); #endif // NO_LEGACY_DRIVERS 不知道这个HalMakeBeep怎么用,属于undocument的函数.我的开发环境是XPDDK,写的是WDM的driver. |
|
|
沙发#
发布于:2004-11-19 15:50
去看undocumented windows 2000 secret 的p403-p404.
|
|
板凳#
发布于:2004-11-19 15:50
去看undocumented windows 2000 secrets 的p403-p404.
|
|
地板#
发布于:2004-11-19 17:28
感谢并给分。
正在下载那书.... |
|
|
地下室#
发布于:2004-11-19 19:41
http://www.driverdevelop.com/forum/viewthread.php?tid=28137
|
|
|
5楼#
发布于:2004-11-20 02:21
HalMakeBeep没信心 !!
这又如何?? #include "ntddbeep.h" void NTBeep() { BEEP_SET_PARAMETERS par; NTSTATUS status; IO_STATUS_BLOCK iosb; UNICODE_STRING beepDev; OBJECT_ATTRIBUTES objAttrib; HANDLE bfile; par.Frequency = 800; par.Duration = 100; RtlInitUnicodeString(&beepDev, DD_BEEP_DEVICE_NAME_U); InitializeObjectAttributes(&objAttrib, &beepDev, OBJ_CASE_INSENSITIVE, NULL, NULL); status = ZwCreateFile(&bfile, GENERIC_WRITE, &objAttrib, &iosb, NULL, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0); status = ZwDeviceIoControlFile(bfile, 0, 0, 0, &iosb, IOCTL_BEEP_SET, &par, sizeof par, 0, 0); if (status == STATUS_PENDING) status = iosb.Status; DbgPrint("NTBeep success ! \n"); } |
|
6楼#
发布于:2004-11-23 10:05
HalMakeBeep没信心 !! 感激至死.... 昨天我研究了一下,哥们出的招很到位,一直只是认为小小的BEEP函数到了driver里面还要如此费劲才能搞定有点不值当,但用户逼得紧迫来不及等待了, 我发现这个 status = ZwDeviceIoControlFile(bfile, 0, 0, 0, &iosb,IOCTL_BEEP_SET, &par, sizeof par,0, 0);无法找到声明,后来我用了Walter Oney Chapter 5 The I/O Request Packet里的Summary―Eight IRP-Handling Scenarios第6个场景Scenario 6―Your Own Synchronous IRP SOMETYPE SomeFunction(PDEVICE_EXTENSION pdx, PDEVICE_OBJECT DeviceObject) { NTSTATUS status = IoAcquireRemoveLock(&pdx->RemoveLock, (PVOID) 42); if (!NT_SUCCESS(status)) return <status>; PIRP Irp; Irp = IoBuildAsynchronousFsdRequest(IRP_MJ_XXX, DeviceObject, ...); -or- Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp); stack->MajorFunction = IRP_MJ_XXX; <additional initialization) IoSetCompletionRoutine[Ex]([pdx->DeviceObject,] Irp, (PIO_COMPLETION_ROUTINE) CompletionRoutine, pdx, TRUE, TRUE, TRUE); ObReferenceObject(DeviceObject); IoCallDriver(DeviceObject, Irp); ObDereferenceObject(DeviceObject); } NTSTATUS CompletionRoutine(PDEVICE_OBJECT junk, PIRP Irp, PDEVICE_EXTENSION pdx) { <IRP cleanup -- see below> IoFreeIrp(Irp); IoReleaseRemoveLock(&pdx->RemoveLock, (PVOID) 42); return STATUS_MORE_PROCESSING_REQUIRED; } 只可惜我电脑的speaker有problem,但没有BSOD过,我想问题应该不大,等用户试了再说. 大虾不愧是月专家分TOP10,表示感谢. |
|
|
7楼#
发布于:2004-11-26 16:33
只可惜我电脑的speaker有problem,但没有BSOD过,我想问题应该不大,等用户试了再说. 本周三去用户处测试,BEEP真是满天飞. 对KMK专家再表感谢! |
|
|
8楼#
发布于:2015-10-20 15:35
用户被禁言,该主题自动屏蔽! |
|