| 
			 
					阅读:1816回复:11
				 
				如何在 Kernel 下 Beep ?
					在 ntddk.h 有下面函数
 
							// // System beep functions. // #if !defined(NO_LEGACY_DRIVERS) NTHALAPI BOOLEAN HalMakeBeep( IN ULONG Frequency ); #endif // NO_LEGACY_DRIVERS 生成下面 void Beep(int Frequency) { HalMakeBeep(Frequency); KeStallExecutionProcessor(100000); // beep  | 
	|
| 
			 沙发# 
								发布于:2002-12-10 13:02				
			
					在 sources 里删除了 DRIVERTYPE=WDM 天下太平 !!!! 
							[编辑 - 12/11/02 by KMK]  | 
	|
| 
			 板凳# 
								发布于:2002-12-09 13:48				
			
					我				 
							 | 
	|
| 
			 地板# 
								发布于:2002-12-09 13:06				
			
					[quote]最後好了 !! 可以 Beep !!
 
							方法如下 : void Beep(int Frequency) { LARGE_INTEGER liDelay = RtlConvertLongToLargeInteger(-800000); HalMakeBeep(Frequency); // KeStallExecutionProcessor(50); // Wait <---- this not working !!!! KeDelayExecutionThread(KernelMode,FALSE ,&liDelay ); HalMakeBeep(0); // Silence please :o) } 改用 KeDelayExecutionThread 这函数就好了,但 KeStallExecutionProcessor 就是出邋 ?! 不知其所以焉 !! 我用这 Beep() 在我的第一个driver上,起  | 
	|
| 
			 地下室# 
								发布于:2002-12-09 12:16				
			
					最後好了 !! 可以 Beep !!
 
							方法如下 : void Beep(int Frequency) { LARGE_INTEGER liDelay = RtlConvertLongToLargeInteger(-800000); HalMakeBeep(Frequency); // KeStallExecutionProcessor(50); // Wait <---- this not working !!!! KeDelayExecutionThread(KernelMode,FALSE ,&liDelay ); HalMakeBeep(0); // Silence please :o) } 改用 KeDelayExecutionThread 这函数就好了,但 KeStallExecutionProcessor 就是出邋 ?! 不知其所以焉 !! 我用这 Beep() 在我的第一个driver上,起  | 
	|
| 
			 5楼# 
								发布于:2002-12-09 09:36				
			
					[quote]问题在下面,程式编译没出错,但哕\行就死机,把源程和代码分列如下,HalMakeBeep				 
							 | 
	|
| 
			 6楼# 
								发布于:2002-12-07 17:42				
			
					好难,不懂!				 
							 | 
	|
| 
			 7楼# 
								发布于:2002-12-07 16:50				
			
					问题在下面,程式编译没出错,但哕\行就死机,把源程和代码分列如下,HalMakeBeep				 
							 | 
	|
| 
			 8楼# 
								发布于:2002-12-05 03:31				
			
					推一推吧,20大洋啊 !!
 
							除 HalMakeBeep() 外有别的方法 Beep 吗 ??  | 
	|
| 
			 9楼# 
								发布于:2002-12-02 10:27				
			
					不是	KeStallExecutionProcessor(100000); 
 
							我在下面情况下是可正常工作的 !! VOID KBeepUnload(IN PDRIVER_OBJECT DriverObject) { WCHAR DOSNameBuffer[] = L\"\\\\DosDevices\\\\KBeep\"; UNICODE_STRING uniDOSString; // HalMakeBeep(1000); KeStallExecutionProcessor(100000); // Wait // HalMakeBeep(0); // Silence please :o) KdPrint( (\"KBeep : Unloading . . .\\n\") ); PopupDrvMsgBox(\"KBeep: Unloading ... . . .\"); RtlInitUnicodeString(&uniDOSString, DOSNameBuffer); IoDeleteSymbolicLink (&uniDOSString); IoDeleteDevice(DriverObject->DeviceObject); } 就是一句 HalMakeBeep(0); 都死机 !!! 两台机器都是Win2K,真不明白啊 !?!?  | 
	|
| 
			 10楼# 
								发布于:2002-12-02 08:38				
			KeStallExecutionProcessor Drivers that call this routine should minimize the number of microseconds they specify (no more than 50). If a driver must wait for a longer interval, it should use another synchronization mechanism.  | 
	|
					
						
  | 
	
| 
			 11楼# 
								发布于:2002-12-02 08:20				
			
					你在哪一级上调用的?				 
							 | 
	|