Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to install a driver which i wrote ,but during installation, the install failed errors always incurred, i debugged and found out that this function is where the errors showed.
here is the code :
if (!UpdateDriverForPlugAndPlayDevices(0, // No Window Handle
                                           m_hwid, // Hardware ID
                                           m_infname, //  inf FileName
                                           INSTALLFLAG_FORCE, 
                                           &RebootRequired)) 
    {
 
        MessageBox(m_ids3);
        CDialog::OnCancel();
        return; // Install Failure
}

i wondered what caused this problem,anyone where can help,please give me a direction,thanks.for me , i thought maybe the inf file have errors ,so tha driver can be installed on thec omputer .the computer is 64bits .
Posted
Updated 23-May-11 4:37am
v2

Use GetLastError() to check the error message.
->[^]

1) Is m_hWnd is LPCSTR type?
2) Is m_infname is the full path of file name?
 
Share this answer
 
Comments
Stefan_Lang 23-May-11 10:38am    
My 5. GetLastError() is exactly what MSDN recommends:
http://msdn.microsoft.com/en-us/library/ff553534%28v=vs.85%29.aspx
ShilpiP 24-May-11 1:07am    
Thanks Stefan :)
markfilan 23-May-11 23:53pm    
the erroe code i got is the operation complete successfully........so where is the problem .because i used getlasterror in the if{}function .so it;s obvious that the function didn't do what i wanted to .
ShilpiP 24-May-11 1:09am    
I asked you two more questions. Is m_hWnd is string type and Is m_infname is full path of file name ??
Stefan_Lang 24-May-11 5:12am    
Now this is odd, if the call to update returned false, then you can't get 'OK' on GetLastError(). I've checked and found there may be a problem with that function, see the first comment on this site: http://msdn.microsoft.com/en-us/library/ms679360%28v=vs.85%29.aspx

If you have VS2008, put a breakpoint behind your call to GetLastError() and check the result again.
As SP 24 suggested, you should check the error code using GetLastError(). Judging by what you said it could be ERROR_IN_WOW64. See the MSDN documentation on UpdateDriverForPlugAndPlayDevices

ERROR_IN_WOW64: The calling application is a 32-bit application attempting to execute in a 64-bit environment, which is not allowed.

If this is it, make sure your installer is being built as a 64 bit application.
 
Share this answer
 
v2
Comments
markfilan 23-May-11 20:48pm    
But I already compiled the project on the 64bitd computer and the driver,so the installer should can be used on 64bits computer .
Stefan_Lang 24-May-11 4:12am    
That is not the point. You can compile and build and run a project as 32 bit, even on a 64 bit machine. If you want 64 bit code you have to make sure your project settings are set accordingly. What you can not do is call functions from 64 bit system libraries from a 32 bit application, and that may be your problem, if indeed you do get the error code mentioned above. Did you check?
markfilan 24-May-11 21:03pm    
i flash back and found out that when the code try to copy driver to to system directory,it got the "access denied"error.
markfilan 23-May-11 23:50pm    
it's strange tha error i got is :the operation completed successfully..........so this fuction worked well.so where is the problem ?please help.
Stefan_Lang 24-May-11 4:14am    
I don't get that - above you said you get an error. Did you call GetLastError()? And what did it return?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900