| 
			 
					阅读:2826回复:6
				 
				我用is安装驱动,生成了ome*.inf,怎么在卸载的时候把这些oem*.inf也一起删除掉?
					就是把本安装程序生成的oem*.inf删掉,但是其它的不动,怎么实现呢?				 
							 | 
	|
| 
			 沙发# 
								发布于:2007-06-11 17:20				
			
					InstallScript: 
							/********************************************************************** * function : FindStrInFile(str) * description : this function will delete the *.inf and correspondent * *.pnf file of driver in inf directory. * ***********************************************************************/ function FindStrInFile(str) string svMatchingFileName,svSubStr,svLine,svFileName; NUMBER nResult,nvFileHandle; begin // Get the first file that matches the file spec. nResult = FindAllFiles (infDir, "oem*.inf", svMatchingFileName, RESET); while(nResult = 0) // Set the file mode to normal. OpenFileMode (FILE_MODE_NORMAL); StrSub ( svFileName, svMatchingFileName, StrLength (infDir), StrLength (svMatchingFileName)- StrLength (infDir)); if (OpenFile ( nvFileHandle, infDir, svFileName ) < 0) then MessageBox (" Failed to open file "+infDir^svFileName, SEVERE); endif; // Get lines from the file into the list. while (GetLine (nvFileHandle, svLine) = 0) //str is the input string! //find the string and cancel the find in files! if(StrFind ( svLine, str ) >0) then //delete the inf file! if (CloseFile ( nvFileHandle ) < 0) then //MessageBox ("CloseFile failed.", SEVERE); endif; //MessageBox (svMatchingFileName+"Will be deleted.", SEVERE); SetFileInfo (svMatchingFileName, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, ""); DeleteFile ( svMatchingFileName ); //delete the pnf file! StrSub ( svSubStr, svMatchingFileName, 0, StrLength (svMatchingFileName)-4 ); SetFileInfo (svSubStr+".PNF", FILE_ATTRIBUTE, FILE_ATTR_NORMAL, ""); DeleteFile ( svSubStr+".PNF" ); // goto showmatches; endif ; endwhile; CloseFile ( nvFileHandle ); // Find the next matching file name. nResult = FindAllFiles(infDir, "oem*.inf", svMatchingFileName, CONTINUE); endwhile; //showmatches: // Free all files and folders accessed by FindAllFiles. If your // setup does not target the Windows NT platform, this step is // not necessary. FindAllFiles(infDir, "oem*.inf", svMatchingFileName, CANCEL); end;  | 
	|
					
						
  | 
	
| 
			 板凳# 
								发布于:2007-06-11 21:12				
			
					多谢,我去试一下				 
							 | 
	|
| 
			 驱动小牛 
					 
				 | 
		
			 地板# 
								发布于:2007-09-18 16:28				
			
					需要的哦				 
							 | 
	
| 
			 地下室# 
								发布于:2007-09-19 17:47				
			
					注册表 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318} 
							下有已安装驱动的相关信息,包括 inf文件的名字和位置 注意上述 ControlSet002 及 {4D36E96C-E325-11CE-BFC1-08002BE10318} 只是示例,请自行在注册表里搜索相关信息。  | 
	|
| 
			 驱动小牛 
					 
				 | 
		
			 5楼# 
								发布于:2007-09-20 13:56				
			
					danielxu22 大哥,这个代码是Dephi的么?有没有VC的				 
							 | 
	
| 
			 驱动小牛 
					 
				 | 
		
			 6楼# 
								发布于:2007-09-20 14:39				
			
					这个是InstallSheild中的脚本么?				 
							 |