Why my driver is not running

why so many error 21 Reputation points
2022-08-19T08:41:39.013+00:00

I used vs' framework to generate a simple minifirter,He didn't do anything
I used the code below to install the driver

TCHAR FilterName[] = L"UVCFilter";  
TCHAR FilterPath[] = L"D:\\UVCFilter\\Debug\\UVCFilter.sys";  
int main()  
{  
	  
    SC_HANDLE sc =  OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);  
	if (sc == NULL)  
	{  
		ULONG ErrorVal = GetLastError();  
		return 0;  
	}  
	SC_HANDLE HServer =OpenService(sc, FilterName, SERVICE_ALL_ACCESS);  
	if (HServer == NULL)  
	{  
		ULONG ErrorVal = GetLastError();  
	}  
	if (!DeleteService(HServer))  
	{  
		ULONG ErrorVal = GetLastError();  
	}   
	HServer = CreateService(sc, FilterName, FilterName, SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER,  
		SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, FilterPath, NULL, NULL, L"FltMgr", NULL, NULL);  
	if (HServer ==NULL)  
	{  
		ULONG ErrorVal = GetLastError();  
		return 0;  
	}   
}  

I used the registry to make him a filter for the camera
232737-qq%E6%88%AA%E5%9B%BE20220819141307.png

You can see that the addition was successful

232728-qq%E6%88%AA%E5%9B%BE20220819141652.png

My driver was added but did not start!

232709-qq%E6%88%AA%E5%9B%BE20220819141920.png

<The device is working properly.

Windows does not start the associated device driver. To learn more, click the Drivers tab, and then click Driver Details>

Would love to be helped, I haven't made a driver before, I haven't found any solutions on the web, I can't fix this problem

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,519 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,541 questions
{count} votes

3 answers

Sort by: Most helpful
  1. why so many error 21 Reputation points
    2022-08-19T08:44:59.003+00:00

    I tried installing using an inf file, but with the same effect

    0 comments No comments

  2. Limitless Technology 43,926 Reputation points
    2022-08-19T14:47:39.043+00:00

    Hello there,

    Can you check for any codes generated in the event viewer while you try to run the driver ?

    The device driver might not be installed or it might not be installed correctly. This error also typically indicates one of the following conditions:

    -A .NET Framework installation on your system has become corrupted.
    -The version of .NET Framework needed by your application cannot be detected.

    This article covers error codes that are generated by Device Manager in Windows. Error codes in Device Manager in Windows https://support.microsoft.com/en-us/topic/error-codes-in-device-manager-in-windows-524e9e89-4dee-8883-0afa-6bca0456324e

    Hope this resolves your Query !!

    ---

    --If the reply is helpful, please Upvote and Accept it as an answer–