Click here to Skip to main content
15,897,519 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC6 compiler bug? Pin
Bob Stanneveld5-Sep-05 9:46
Bob Stanneveld5-Sep-05 9:46 
GeneralRe: VC6 compiler bug? Pin
Ravi Bhavnani5-Sep-05 9:53
professionalRavi Bhavnani5-Sep-05 9:53 
QuestionHelp on WebBrowser Pin
Cao Jianlin5-Sep-05 5:05
Cao Jianlin5-Sep-05 5:05 
QuestionRegistry Editing C++ Pin
u6ik5-Sep-05 5:03
u6ik5-Sep-05 5:03 
AnswerRe: Registry Editing C++ Pin
u6ik5-Sep-05 6:44
u6ik5-Sep-05 6:44 
QuestionAbout MS Access Database in vc++:==Plz Help Pin
parims5-Sep-05 3:13
parims5-Sep-05 3:13 
AnswerRe: About MS Access Database in vc++:==Plz Help Pin
Marc Soleda5-Sep-05 3:39
Marc Soleda5-Sep-05 3:39 
QuestionRemove Device Pin
Peter Prescher5-Sep-05 2:56
Peter Prescher5-Sep-05 2:56 
Hi,
How can one the setupapi device driver removing?
What do I make wrong in my code?
Can anybody help me at the problem?

Thanks

PeterConfused | :confused:


<br />
#include "stdafx.h"<br />
#include <stdio.h><br />
#include <windows.h><br />
#include <setupapi.h><br />
#include "cfgmgr32.h"<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
<br />
    PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd;<br />
    SP_DEVICE_INTERFACE_DATA         spdid;<br />
    SP_DEVINFO_DATA                  spdd;<br />
    HDEVINFO                         hDevInfo;<br />
    DWORD                            dwIndex, dwSize, dwType;<br />
    TCHAR                            szProperty[256];<br />
	  GUID ClassGUID;<br />
	  TCHAR ClassName[MAX_CLASS_NAME_LEN];<br />
	  LPTSTR INFFile = argv[1];<br />
	  CString strInfClassID;<br />
	  BOOL isInstall = FALSE;<br />
	<br />
    ZeroMemory(&spdid, sizeof(spdid));<br />
    spdid.cbSize = sizeof(spdid);<br />
<br />
	//*****************************************************************************<br />
	// Use the INF File to extract the Class GUID.<br />
	if(!SetupDiGetINFClass(INFFile,&ClassGUID,ClassName,sizeof(ClassName),0))<br />
	{<br />
		printf("GetINFClass");<br />
		goto cleanup_DeviceInfo;<br />
	}<br />
<br />
	//*****************************************************************************<br />
	// GUID aus Inffile einlesen<br />
	LPOLESTR InfBuffer;<br />
<br />
	StringFromCLSID( ClassGUID, &InfBuffer );<br />
	strInfClassID = InfBuffer;<br />
	CoTaskMemFree(InfBuffer);<br />
<br />
<br />
	//*****************************************************************************<br />
    hDevInfo = SetupDiGetClassDevs(&ClassGUID, NULL, NULL,<br />
                                   DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);<br />
	<br />
	<br />
	<br />
	<br />
<br />
	if(hDevInfo == INVALID_HANDLE_VALUE)<br />
	{<br />
		printf("SetupDiGetClassDevs nicht gefunden.\n ");<br />
		goto cleanup_DeviceInfo;<br />
<br />
	}<br />
<br />
	//*****************************************************************************<br />
<br />
	<br />
    for(dwIndex = 0; (SetupDiEnumDeviceInterfaces(hDevInfo,NULL, &ClassGUID, dwIndex,&spdid)); dwIndex++)<br />
    {<br />
<br />
	      SP_REMOVEDEVICE_PARAMS rmdParams;<br />
        <br />
		    rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);<br />
        rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;<br />
        rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;<br />
        rmdParams.HwProfile = 0;<br />
<br />
		    if(!SetupDiSetClassInstallParams(hDevInfo,NULL,&rmdParams.ClassInstallHeader,sizeof(rmdParams)) ||<br />
										!SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,NULL)) <br />
		    {<br />
			      printf("Driver not remove.");<br />
		    }<br />
		    else<br />
		    {<br />
			      printf("Driver remove.");<br />
<br />
		    }<br />
<br />
<br />
    }<br />
<br />
cleanup_DeviceInfo:<br />
<br />
    SetupDiDestroyDeviceInfoList(hDevInfo);<br />
	<br />
	return 0;<br />
}<br />
<br />
<br />
Sigh | :sigh: Sigh | :sigh:
QuestionChanging Color of Ctrl Pin
Identity Undisclosed5-Sep-05 2:40
Identity Undisclosed5-Sep-05 2:40 
AnswerRe: Changing Color of Ctrl Pin
toxcct5-Sep-05 2:48
toxcct5-Sep-05 2:48 
AnswerRe: Changing Color of Ctrl Pin
seq-5-Sep-05 11:11
seq-5-Sep-05 11:11 
QuestionCHttp Pin
Tcpip20055-Sep-05 2:15
Tcpip20055-Sep-05 2:15 
AnswerRe: CHttpFile Pin
Tcpip20055-Sep-05 2:19
Tcpip20055-Sep-05 2:19 
GeneralRe: CHttpFile Pin
Neagoe Gabriel5-Sep-05 2:42
Neagoe Gabriel5-Sep-05 2:42 
GeneralRe: CHttpFile Pin
Tcpip20055-Sep-05 2:52
Tcpip20055-Sep-05 2:52 
GeneralRe: CHttpFile Pin
Neagoe Gabriel5-Sep-05 4:23
Neagoe Gabriel5-Sep-05 4:23 
AnswerRe: CHttp Pin
MailtoGops5-Sep-05 3:12
MailtoGops5-Sep-05 3:12 
AnswerRe: CHttp Pin
Gary R. Wheeler5-Sep-05 4:04
Gary R. Wheeler5-Sep-05 4:04 
Questionhwnd Pin
Ali Tavakol5-Sep-05 1:53
Ali Tavakol5-Sep-05 1:53 
AnswerRe: hwnd Pin
Bob Stanneveld5-Sep-05 2:00
Bob Stanneveld5-Sep-05 2:00 
Answer[Message Deleted] Pin
Neagoe Gabriel5-Sep-05 2:00
Neagoe Gabriel5-Sep-05 2:00 
AnswerRe: hwnd Pin
Neagoe Gabriel5-Sep-05 2:03
Neagoe Gabriel5-Sep-05 2:03 
Questionproblem with templates please help Pin
Member 22477495-Sep-05 0:03
Member 22477495-Sep-05 0:03 
QuestionHotFix Pin
Supriya Tonape4-Sep-05 23:57
Supriya Tonape4-Sep-05 23:57 
AnswerRe: HotFix Pin
ThatsAlok5-Sep-05 0:09
ThatsAlok5-Sep-05 0:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.