<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Remove Gerätetreiber die 2.]]></title><description><![CDATA[<p>Hallo,</p>
<p>Hier noch mal ein augebessertes Codebeispiel.<br />
Der Treiber wird aber nicht entfernt. Ich habe mir nochmal die Remove Funktion angesehen und in dieses Beispiel eingebaut.</p>
<p>Hat irgend jemand eine Ahnung was hier nicht korrekt ist.</p>
<p>Danke</p>
<p>Peter Prescher</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
#include &lt;setupapi.h&gt;
#include &quot;cfgmgr32.h&quot;

int main(int argc, char* argv[])
{

    PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd;
    SP_DEVICE_INTERFACE_DATA         spdid;
    SP_DEVINFO_DATA                  spdd;
    HDEVINFO                         hDevInfo;
    DWORD                            dwIndex, dwSize, dwType;
    TCHAR                            szProperty[256];
	  GUID ClassGUID;
	  TCHAR ClassName[MAX_CLASS_NAME_LEN];
	  LPTSTR INFFile = argv[1];
	  CString strInfClassID;
	  BOOL isInstall = FALSE;

    ZeroMemory(&amp;spdid, sizeof(spdid));
    spdid.cbSize = sizeof(spdid);

	//*****************************************************************************
	// Use the INF File to extract the Class GUID.
	if(!SetupDiGetINFClass(INFFile,&amp;ClassGUID,ClassName,sizeof(ClassName),0))
	{
		printf(&quot;GetINFClass&quot;);
		goto cleanup_DeviceInfo;
	}

	//*****************************************************************************
	// GUID aus Inffile einlesen
	LPOLESTR InfBuffer;

	StringFromCLSID( ClassGUID, &amp;InfBuffer );
	strInfClassID = InfBuffer;
	CoTaskMemFree(InfBuffer);

	//*****************************************************************************
    hDevInfo = SetupDiGetClassDevs(&amp;ClassGUID, NULL, NULL,
                                   DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);

	if(hDevInfo == INVALID_HANDLE_VALUE)
	{
		printf(&quot;SetupDiGetClassDevs nicht gefunden.\n &quot;);
		goto cleanup_DeviceInfo;

	}

	//*****************************************************************************

    for(dwIndex = 0; (SetupDiEnumDeviceInterfaces(hDevInfo,NULL, &amp;ClassGUID, dwIndex,&amp;spdid)); dwIndex++)
    {

	      SP_REMOVEDEVICE_PARAMS rmdParams;

		    rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
        rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;
        rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;
        rmdParams.HwProfile = 0;

		    if(!SetupDiSetClassInstallParams(hDevInfo,NULL,&amp;rmdParams.ClassInstallHeader,sizeof(rmdParams)) ||
										!SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,NULL)) 
		    {
			      printf(&quot;Driver not remove.&quot;);
		    }
		    else
		    {
			      printf(&quot;Driver remove.&quot;);

		    }

    }

cleanup_DeviceInfo:

    SetupDiDestroyDeviceInfoList(hDevInfo);

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/119770/remove-gerätetreiber-die-2</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 01:00:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119770.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Sep 2005 12:42:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Remove Gerätetreiber die 2. on Mon, 05 Sep 2005 12:42:59 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Hier noch mal ein augebessertes Codebeispiel.<br />
Der Treiber wird aber nicht entfernt. Ich habe mir nochmal die Remove Funktion angesehen und in dieses Beispiel eingebaut.</p>
<p>Hat irgend jemand eine Ahnung was hier nicht korrekt ist.</p>
<p>Danke</p>
<p>Peter Prescher</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;
#include &lt;setupapi.h&gt;
#include &quot;cfgmgr32.h&quot;

int main(int argc, char* argv[])
{

    PSP_DEVICE_INTERFACE_DETAIL_DATA pspdidd;
    SP_DEVICE_INTERFACE_DATA         spdid;
    SP_DEVINFO_DATA                  spdd;
    HDEVINFO                         hDevInfo;
    DWORD                            dwIndex, dwSize, dwType;
    TCHAR                            szProperty[256];
	  GUID ClassGUID;
	  TCHAR ClassName[MAX_CLASS_NAME_LEN];
	  LPTSTR INFFile = argv[1];
	  CString strInfClassID;
	  BOOL isInstall = FALSE;

    ZeroMemory(&amp;spdid, sizeof(spdid));
    spdid.cbSize = sizeof(spdid);

	//*****************************************************************************
	// Use the INF File to extract the Class GUID.
	if(!SetupDiGetINFClass(INFFile,&amp;ClassGUID,ClassName,sizeof(ClassName),0))
	{
		printf(&quot;GetINFClass&quot;);
		goto cleanup_DeviceInfo;
	}

	//*****************************************************************************
	// GUID aus Inffile einlesen
	LPOLESTR InfBuffer;

	StringFromCLSID( ClassGUID, &amp;InfBuffer );
	strInfClassID = InfBuffer;
	CoTaskMemFree(InfBuffer);

	//*****************************************************************************
    hDevInfo = SetupDiGetClassDevs(&amp;ClassGUID, NULL, NULL,
                                   DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);

	if(hDevInfo == INVALID_HANDLE_VALUE)
	{
		printf(&quot;SetupDiGetClassDevs nicht gefunden.\n &quot;);
		goto cleanup_DeviceInfo;

	}

	//*****************************************************************************

    for(dwIndex = 0; (SetupDiEnumDeviceInterfaces(hDevInfo,NULL, &amp;ClassGUID, dwIndex,&amp;spdid)); dwIndex++)
    {

	      SP_REMOVEDEVICE_PARAMS rmdParams;

		    rmdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
        rmdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE;
        rmdParams.Scope = DI_REMOVEDEVICE_GLOBAL;
        rmdParams.HwProfile = 0;

		    if(!SetupDiSetClassInstallParams(hDevInfo,NULL,&amp;rmdParams.ClassInstallHeader,sizeof(rmdParams)) ||
										!SetupDiCallClassInstaller(DIF_REMOVE,hDevInfo,NULL)) 
		    {
			      printf(&quot;Driver not remove.&quot;);
		    }
		    else
		    {
			      printf(&quot;Driver remove.&quot;);

		    }

    }

cleanup_DeviceInfo:

    SetupDiDestroyDeviceInfoList(hDevInfo);

	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/865394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/865394</guid><dc:creator><![CDATA[P.Prescher]]></dc:creator><pubDate>Mon, 05 Sep 2005 12:42:59 GMT</pubDate></item><item><title><![CDATA[Reply to Remove Gerätetreiber die 2. on Mon, 05 Sep 2005 13:11:47 GMT]]></title><description><![CDATA[<p>Musst du eigentlich das ganze Internet mit deinen Beiträgen vollspammen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/865414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/865414</guid><dc:creator><![CDATA[newsgroupleser]]></dc:creator><pubDate>Mon, 05 Sep 2005 13:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to Remove Gerätetreiber die 2. on Mon, 05 Sep 2005 13:18:49 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>vieleicht kannste helfen? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/865422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/865422</guid><dc:creator><![CDATA[P.Prescher]]></dc:creator><pubDate>Mon, 05 Sep 2005 13:18:49 GMT</pubDate></item></channel></rss>