|
Yes I tried DeviceIoControl(hDrivee,SMART_GET_VERSION,...).But it is returning zero.
|
|
|
|
|
Hi,
I also actually try this, and it doesn't work, and DeviceIoControl doesn't work neither with CreateFile ("\\\\.\\PhysicalDrive%d",...), nor with CreateFile ("\\\\.\\Scsi%d:",...).
I have found an interesting source in internet , see Guckst du hier[^] explaining a workaround for SMART with SCSI drives, but even after some needed code corrections (e.g. adding iobuff definitions, etc.), this doesn't worked for me (now I've got error 55 instead of 1117). If you have more luck, I would appreciate a answer from you .
BR
|
|
|
|
|
Abinash Mohanty wrote: But it is returning zero.
Which means you should then call GetLastError() to find out why.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I would guess ERROR_INVALID_FUNCTION ...
It seems that SCSI doesn't support this method. But S.M.A.R.T. is supported by a different way, because tools like Crystal Disk Info are showing correct info.
|
|
|
|
|
Hi, Have you fixed that problem now?
It also bother me, I can't get SMART info in SCSI hard disk by SMART_GET_VERSION.
Could you pls tell me your method ?
my mail:aishui0905@163.com
Thank you !
|
|
|
|
|
Yes, I made a workaround. I do not need the SMART_GET_VERSION, it was only a test which version is supported. Since the function has failed, I stepped out the procedure.
In my workaround I do not bother if the command fails in try to read the SMART infos. This works on all my test systems .
|
|
|
|
|
So you still have no solution of SMART IN SCSI HDD,right?
|
|
|
|
|
Sure. My aim was, to read the smart info on SCSI drives. This is working fine now. What doesn't work, is to read the SMART version numbor on SCSI. But that's a minor problem and is not really bothering.
|
|
|
|
|
Hello All,
I want to Create ISO9660 image file , So how to convert
normal file/folders to ISO9660 image file format. If any source code
will be greatly appriciated, matter urgent.
I simply want to add files and dirs and create the iso image from that.
there is no useful answer in Codeproject and other web sites....
Thanks in Advance.
|
|
|
|
|
Hi,
InfraRecorder[^] is open source and it can create ISO files. If think that it uses cygwin to create binary for Windows, but am not sure. Just have a look at it.
ISO Master[^] is another such thing, but they provide source code that compiles only on Unix/Linux like operating systems.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I have created a win32 resource dll which has only string table, also i have included \NOENTRY in linker options in-order to make it as resource only dll
Now I am loading the dll in MFC application and loads fine but when I am try to get the string from the string table it doens't load. Here is my code:
HINSTANCE hinsttance = ::LoadLibrary("SampleEN.dll");
DWORD dwError = GetLastError();
if (!hinsttance)
{
AfxMessageBox("Failed to load");
}
else
{
HINSTANCE hInstResourceClient = AfxGetResourceHandle();
AfxSetResourceHandle(hinsttance);
LPCTSTR lpszName = MAKEINTRESOURCE(1);
HRSRC hrsrc = FindResource(m_hinstLib, lpszName, RT_STRING);
if (hrsrc)
{
TCHAR szTemp[256];
LoadString(m_hinstLib, IDC_STATIC_TOP, szTemp, 255);
}
AfxSetResourceHandle(hInstResourceClient);
}
what could be the problem???
|
|
|
|
|
Super Hornet wrote: HRSRC hrsrc = FindResource(m_hinstLib, lpszName, RT_STRING);
What is m_hinstLib?
It should be hinsttance.
Then use the handle returned by FindResource in a call to LoadResource .
To access the actual resource call LockResource on the handle returned by LoadResource .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Actually it's - hinsttance, mistakenly written here as m_hinstLib
|
|
|
|
|
Where exactly does it fail?
Is it the FindResource that is failing or is it LoadString ?
Try it without the AfxSetResourceHandle call.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Modified code according to your suggestion:
HINSTANCE hinstance = ::LoadLibrary("SampleEN.dll");
if (!hinstance)
{
AfxMessageBox("Failed to load");
}
else
{
HINSTANCE hInstResourceClient = AfxGetResourceHandle();
AfxSetResourceHandle(hinstance);
LPCTSTR lpszName = MAKEINTRESOURCE(1);
HRSRC hrsrc = FindResource(hinstance, lpszName, RT_STRING);
if (hrsrc)
{
HGLOBAL hglobal = LoadResource(hinstance, hrsrc);
LockResource(hglobal);
TCHAR szTemp[256];
LoadString(hinstance, IDC_STATIC_TOP, szTemp, 255);
}
AfxSetResourceHandle(hInstResourceClient);
}
even now the string is empty. I get the error code: 1814 - which says resource couldn't be found. But I have re-verfied that the ID exists in the string table
|
|
|
|
|
I have tried commenting the statement
AfxSetResourceHandle(hinstance); but the same error
The error code 1814 comes after LaodString call
|
|
|
|
|
Now I am able to get the correct value's
The problem is with resource id's, I haven't defined same resource id in dll and in mfc application.
|
|
|
|
|
Super Hornet wrote: m_hinstLib
What's that? Your resource DLL's handle is hinsttance ...
|
|
|
|
|
thank you for pointing the error
|
|
|
|
|
I m doing a database application.
in my OnNewDocument() i have the following code..
HRESULT hr;
try
{
AfxMessageBox("Inside try executed.",NULL,MB_OK); //Excecuted
hr = m_pConnection.CreateInstance(__uuidof(Connection));
AfxMessageBox("Created instance executed.",NULL,MB_OK);
if(SUCCEEDED(hr))
{
AfxMessageBox("If hr succeeded.",NULL,MB_OK);//Not Executed
hr = m_pConnection->Open(_bstr_t(L"Provider=sqloledb;Data Source=C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Data\\LibDB.mdf;"),_bstr_t(L""),_bstr_t(L""),adModeUnknown);
if(SUCCEEDED(hr))
{
AfxMessageBox("Open connection executed.",NULL,MB_OK); //not executed
m_pConnection=TRUE;
}
}
AfxMessageBox("out",NULL,MB_OK);
}
catch(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
TRACE( "Exception thrown for classes generated by #import" );
TRACE( "\tCode = %08lx\n", e.Error());
TRACE( "\tCode meaning = %s\n", e.ErrorMessage());
TRACE( "\tSource = %s\n", (LPCTSTR) bstrSource);
TRACE( "\tDescription = %s\n", (LPCTSTR) bstrDescription);
}
catch(...)
{
TRACE( "*** Unhandled Exception ***" );
}
return TRUE;
}
In the above code the if(SUCCEEDED(hr)) block is not executed.What could be the reason ?
|
|
|
|
|
An hint is given by the hr value.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
vital_parsley2000 wrote: if(SUCCEEDED(hr)) block is not executed.What could be the reason ?
Get the hr value and pass it to FormatMessage function. You will get the cause.
To convert an HRESULT to DWORD you can use the following code snippet!
BOOL WIN32_FROM_HRESULT(HRESULT hr, OUT DWORD *pdwWin32)
{
if ((hr & 0xFFFF0000) == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32)) {
*pdwWin32 = HRESULT_CODE(hr);
return TRUE;
}
if (hr == S_OK) {
*pdwWin32 = HRESULT_CODE(hr);
return TRUE;
}
return FALSE;
}
I found this from here
|
|
|
|
|
where do i insert this
code ?
|
|
|
|
|
vital_parsley2000 wrote: where do i insert this code ?
In your source files, dear!
It is a function , you can either put it in your .cpp file or .h file in global scope or add as a member function in your class.
Am I missing something ?
|
|
|
|
|
Another Tip:
Put the variable hr in the debug watch window, append ", hr" (without the quotes) to it to have Visual C++ translate it for you!
Or you can use pseudo variable $err as $err,hr in Watch window.The $err pseudo variable provides the value, and the hr format specifier tells the watch window to format it as an error code.
http://i.msdn.microsoft.com/dd252945.fig05_L(en-us).gif[^]
modified on Thursday, May 14, 2009 2:21 AM
|
|
|
|