|
|
Comments and Discussions
|
|
 |

|
The project in not running in VS2008, what changes i should do to run
|
|
|
|

|
i want to get hd Info of other computer through network..any solution or suggesstion????
|
|
|
|

|
Hi dmihailescu,
If there are more than 1 HDD installed in a computer, lets say that there are 2 HDDs.
1st HDD is partitioned into 3 partitions namely C:, D;, and E:
2nd HDD is partition into 2 partitions namely F: and G:
How to know one partition belongs to which HDD?
I mean how to know F: belongs to 2nd HDD, and C: belongs to 1st HDD?
Thanks,
Best regards,
Leo
|
|
|
|

|
// Mac Address.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdafx.h"
#include
#include
#include
#include
#include
#include
#include
#include
#define _WIN32_DCOM
#include
#include
#include
#include
#pragma comment(lib, "Netapi32.lib")
#pragma comment(lib, "wsock32.lib")
# pragma comment(lib, "wbemuuid.lib")
using namespace std;
void filewrite(string a,int e)
{
ofstream fout;
if(e==1)
fout.open("System Configuration.txt");
else
{
fout.open("System Configuration.txt", ios::app);
fout<<a;
fout<<endl;
}
fout.close();
}
void getmac()
{
unsigned char MACData[8];
WKSTA_TRANSPORT_INFO_0 *pwkti;
DWORD dwEntriesRead;
DWORD dwTotalEntries;
BYTE *pbBuffer;
NET_API_STATUS dwStatus = NetWkstaTransportEnum(
NULL, // [in] server name
0, // [in] data structure to return
&pbBuffer, // [out] pointer to buffer
MAX_PREFERRED_LENGTH, // [in] maximum length
&dwEntriesRead, // [out] counter of elements actually enumerated
&dwTotalEntries, // [out] total number of elements that could be enumerated
NULL); // [in/out] resume handle
assert(dwStatus == NERR_Success);
pwkti = (WKSTA_TRANSPORT_INFO_0 *)pbBuffer; // type cast the buffer
for(DWORD i=1; i< dwEntriesRead; i++) // first address is 00000000, skip it
{ char dd[33];
// enumerate MACs and print
swscanf((wchar_t *)pwkti[i].wkti0_transport_address, L"%2hx%2hx%2hx%2hx%2hx%2hx",
&MACData[0], &MACData[1], &MACData[2], &MACData[3], &MACData[4], &MACData[5]);
//PrintMACaddress(MACData);
sprintf(dd," %02x-%02x-%02x-%02x-%02x-%02x\n",MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]);
string u="MAC Address :";
u+=dd;
filewrite(u,0);
}
// Release pbBuffer allocated by above function
dwStatus = NetApiBufferFree(pbBuffer);
assert(dwStatus == NERR_Success);
}
void getip()
{
WORD wVersionRequested;
WSADATA wsaData;
char name[255];
PHOSTENT hostinfo;
wVersionRequested = MAKEWORD( 1, 1 );
char *ip;
if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
if( gethostname ( name, sizeof(name)) == 0)
{
//printf("Host name: %s\n", name);
string name1="Computer Name: ";
name1+=name;
filewrite(name1,0);
if((hostinfo = gethostbyname(name)) != NULL)
{
int nCount = 0;
while(hostinfo->h_addr_list[nCount])
{
ip = inet_ntoa (*(struct in_addr *)hostinfo->h_addr_list[nCount]);
++nCount;
//printf("IP #%d: %s\n", ++nCount, ip);
string s="IP Adress : ";
s+=ip;
filewrite(s,0);
}
}
}
}
void getsn_no()
{
CoInitializeEx(0, COINIT_MULTITHREADED);
CoInitializeSecurity(
NULL,
-1, // COM authentication
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // Default authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);
IWbemLocator *pLoc = NULL;
CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &pLoc);
IWbemServices *pSvc = NULL;
pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
NULL, // User name. NULL = current user
NULL, // User password. NULL = current
0, // Locale. NULL indicates current
NULL, // Security flags.
0, // Authority (e.g. Kerberos)
0, // Context object
&pSvc // pointer to IWbemServices proxy
);
IEnumWbemClassObject* pEnumerator = NULL;
ULONG uReturn;
int i=1,x=0;
LPCWSTR lp3;
_bstr_t win32;
string data;
while(i<=7)
{
switch(i)
{
case 1:
filewrite("MOTHER BOARD",0);
win32="SELECT * FROM Win32_BaseBoard";
lp3=L"SerialNumber";
data="SerialNumber :";
break;
case 2:
win32="SELECT * FROM Win32_BaseBoard";
lp3=L"Product";
data="Product ID :";
break;
case 3:
win32="SELECT * FROM Win32_Processor";
lp3=L"ProcessorId";
data="Processor Id :";
x=1;
cout<<"Configuring Software....."<<endl<<endl;
break;
case 4:
filewrite("",0);
filewrite("HARD-DISK & FLAS DRIVE",0);
win32="SELECT * FROM Win32_DiskDrive";
lp3=L"Model";
data="Model NO : ";
break;
case 5:
win32="SELECT * FROM Win32_DiskDrive";
lp3=L"InterfaceType";
data="InterfaceType : ";
break;
case 6:
filewrite("",0);
filewrite("LOCAL DISK's SERIAL No.",0);
win32="SELECT * FROM Win32_LogicalDisk";
lp3=L"Name";
x=3;
break;
case 7:
filewrite("",0);
win32="SELECT * FROM Win32_OperatingSystem";
lp3=L"Name";
filewrite("OS Name |PATH| |PARTITION|",0);
x=0;
break;
}
i++;
pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t(win32),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
IWbemClassObject *pclsObj;
uReturn = 0;
//filewrite("HD&FLASH DRIVE's ",0);
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,&pclsObj, &uReturn);
if(0 == uReturn)
{
break;
}
VARIANT vtProp;
// Get the value of the Name property
pclsObj->Get(lp3, 0, &vtProp, 0, 0);
data+=(const char*)_bstr_t(vtProp.bstrVal);
if(x==3)
{
lp3=L"VolumeSerialNumber";
string n;
n=data;
n+=" ";
pclsObj->Get(lp3, 0, &vtProp, 0, 0);
n+=(const char*)_bstr_t(vtProp.bstrVal);
data=n;
lp3=L"Name";
}
filewrite(data,0);
VariantClear(&vtProp);
pclsObj->Release();
data.clear();
if(x==1)
{
x=0;
break;
}
}
}
pSvc->Release();
pLoc->Release();
pEnumerator->Release();
CoUninitialize();
}
int _tmain(int argc, _TCHAR* argv[])
{
filewrite("",1);
cout<<"Configuring Hardware....."<<endl;
getip();
getmac();
getsn_no();
cout<<endl<<" Configuration Completed";
cout<<endl<<endl<<endl<<"Press any key to continue...";
getch();
return 0;
}
these stuff works 100% in VC++ , but when i try HDD serial no, by means of win32_PhisicalMedia , get(L"SerialNumber",0.....
it return NULL varient Please help
|
|
|
|
|
|
|

|
Nice Code, but I try to figure out how to identify the device driver used for a Physical Disk. Could be PCIIDE, MSAHCI, IASTOR, AMD_AHCI or other, depending on the controller and the mode it is using (IDE, AHCI oder RAID). Does anyone have a solution?
|
|
|
|

|
This project is wrapper under DiskID32 library.
Link to original library WinSim Inc
Also code in this article wrap old version of this library.
|
|
|
|

|
this do not work in C# 4.
and have error in win7
|
|
|
|

|
It is possible to enumerate the drive letters, or to make a match between a drive letter and a HDD in some way?
|
|
|
|

|
Dear sir,
In Windows 7 ultimate , "Release" can't display drive info until i run it with "Run as Administrator" .
I tried this dll into my c# application but can't get information (it display count = 0 on debugging ) i think it redquires admin. rights to run dll ... how to solve it
|
|
|
|
|

|
Very nice............It has get me out of My very hard problem.......
|
|
|
|

|
Sorry to bother about those questions but I don't know c++ and I'm gonna explain my situation.
I created a web app and I want to run it on a cd with asteclick wbea witch uses chrome embedded framework. I have visual c++ 2008 express edition and I downloaded wbea's source code. I was able to compile it fine but I saw in the code the ability to control or access the app with javascript. My idea was to find the cd or dvd serial in c++ using your code and assign it to a string to access it via javascript on my web app.
So basically I was wondering how do I use this in the c++ project to assign the cd or dvd serial to a string.
Sorry for my poor english, my primary language is french.
Thank's
|
|
|
|
|

|
I have a problem to get a Serial number of HDD wich is connected through RAID controller.
I tried to also a DiskID32 it does not give a Serial NUmber too....
|
|
|
|

|
I have run your Demo project binaries on my win7 and dll just work well. therefore, i included it in my project and try to run on target machine which have win Xp with .NET2.0 installed. it's not work neither on my Project as well as yours. below are the Exception of UIHost.exe.
whats going wrong?
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'DriveInfoEx, Version=1.1.3054.15437, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
File name: 'DriveInfoEx, Version=1.1.3054.15437, Culture=neutral, PublicKeyToken=null' ---> System.Runtime.InteropServices.COMException (0x800736B1): This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
at UIClient.MainForm.MainForm_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
UIClient
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///D:/released/UIClient.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
|
|
|
|
|

|
Really nice and clean code...
|
|
|
|

|
Hi,
Thank you for your works. I can use this dll on 32 bit O.S. But I can not use this dll on 64 bit. Could you give more details about running 64 bit O.S. please. Thank you
|
|
|
|

|
This is working great with me.Thaks alt...just a question to ask...
1) Can we implement this with c sharp??
2) Is there any other problems accessing motherboard and processor serial numbers using wmi class?? if there is can u give me a link where other serial numbers of motherboard and etc can be get using the help of c++ like this(using DeviceIoControl API)..
modified on Monday, October 25, 2010 7:33 AM
|
|
|
|

|
Not Work with Framework 4.0, i Required DriveInfoEx.DLL for .Net Framework 4.0
Thanks
Kalpesh Chhatrala
|
|
|
|

|
Hi,
Thanks for the code. When I tried it in my vista 64bit I had a slight problem. The Serial number was almost same as that returned by WMI but the characters were interchanged in groups of two. I mean if the WMI Serial was "ABCDEFGH" I got "BADCFEHG". A simple string manipulation helped match both serial numbers.
Thanks
DJ
|
|
|
|

|
Is anybody know how to change hdd serial ?Please let me know
|
|
|
|

|
Hi,
I have a webservice, and it has to verify the serial number of the hard disk on the server machine. The webservice queries the drives information but it returns an empty list.
I suppose that it is a problem with some permissions. Do you have any idea of what can be the problem?
Thanks for your attention and this so interesting application
|
|
|
|

|
When I rebuild in VS2008, I got 2 err and 1 Warning
IOEx could not be found
Error 1 The type or namespace name 'IOEx' could not be found (are you missing a using directive or an assembly reference?) D:\WTInfoUnit\Applications\DriveInfoEx\DriveInfoEx\UIClient\MainForm.cs 8 7 UIClient
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DriveListEx could not be found
Error 2 The type or namespace name 'DriveListEx' could not be found (are you missing a using directive or an assembly reference?) D:\WTInfoUnit\Applications\DriveInfoEx\DriveInfoEx\UIClient\MainForm.cs 15 9 UIClient
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 Warning:
Warning 3:The referenced component 'DriveInfoEx' could not be found.
Please help.....
Victor
|
|
|
|

|
Hello,
Is it possible for you to include a 64bit dll as output along with your demo application?
Thanks so much.
Josh
|
|
|
|
|

|
Thanks for your library.. it works on XP with me but not vista or 7.
can u tell me the steps in details to build the solution with for vista.
thanks.
|
|
|
|

|
I've tried to build your source under VS2008 but i get lots of build errors with the DriveInfoEx.dll.
Many 'struct' type redefinition errors.
|
|
|
|

|
Thanks for the code examples!!! Love your avatar! "Drop the catnip and spread em"
The grass IS greener on the other side!
|
|
|
|

|
Hi
Thanks for this
but I an having issue while installing on computer where .Net is not installed.
I have installed following
2.0 Framwork is installed
c++ 2008 redistributed package is also installed
is there anything missed ??
Thanks in advance
Plz reply
|
|
|
|

|
when Administrator rights is not given, it is not working for web application in windows server 2003 and vista. So is there any other method to get the HDD manufacturer serial no without admin rights?
|
|
|
|

|
Whether DriveInfoEx.dll supports Windows Server 2008?
Regards,
Christopher
|
|
|
|

|
Whether DriveInfoEx.dll supports Microsoft Win 64 bit machines?
Regards,
Christopher
|
|
|
|

|
Please provide the details of Hard Disk Interface types compatibility with DriveInfoEx.dll
Regards,
Christopher
|
|
|
|

|
Please provide the list of Hard Disk Manufacturers compatibilty with DriveInfoEx.dll
Regards,
Christopher
|
|
|
|

|
How to set administrator rights for IIS (web application asp.net 2.0) which had the reference of DriveInfoEx.dll to run in windows server 2003 and windows vista business edition ?
Kindly give me inputs.
Regards,
Christopher.
|
|
|
|

|
Hello sir,
Will you please update this for VS2008?
So, can able to use it with Visual Studio 2008... Or please provide help to use it with VS2008. It shows so many compilation errors with VS2008...
Thanks!!!
|
|
|
|
|

|
This is exactly what I needed -- hard drive serial number without using WMI. Good work!
|
|
|
|

|
i'm getting this error when users run my exe that refrenced with driveinfoEx.dll
Could not load file or assembly 'DriveInfoEx, Version=1.1.3487.25050, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
but it works great on my machine,could you help me plz.
|
|
|
|

|
It worked on vista for me.
|
|
|
|

|
Do you test it in vista?
i test it for vista but don't work?
CaptainMassoud
|
|
|
|

|
firstly i want to thank you a lot for sharing your code! it is exactly what i was looking for.
the only thing i can't really figure out, is how to give the .dll a strong name.
i recompiled your project in visual basic 2005.
placing in /keyfile:strongkf.snk /delaydesign and
in "$(FrameworkSDKDir).\Bin\sn.exe" -q -Ra "$(TargetPath)""$(ProjectDir).\strongkf.snk"
works fine so far in XP/2000 but not under Vista.
Exception of HRESULT: 0x80131040
Do you have any ideas on that or any other solution tackling this issue?
I am very much looking forward to your answer!
Thanks a lot!
|
|
|
|

|
i was trying to use the code in my applet for logitech G15 but it's hard for a noob and your code can only get data from my nforce sata drives
it's my second app, the first one was to control winamp with commandline
i have never seriously read anything about programming so i hardly understand just the simplest functions
i am worse at programming than to write in English
but i have used some code from diskid32 "ReadPhysicalDriveInNTWithZeroRights"
and it works, but not perfectly. i have 8 sata ports (4 nforce and 4 sil 3114)
and i can get data from sata, usb, scsi (the onboard sil 3114 is listed as scsi)
i can't get serial number from usb devices but i don't think there are any to get
to get the correct serialnumber from scsi i use
char * sserialNumber = (char*)descrip + descrip->SerialNumberOffset;
strcpy_s (serialNumber , sserialNumber);
not flipAndCodeBytes
for (drive = 0; drive < MAX_IDE_DRIVES; drive++) drive is the drives real Physical ID
using this with Win32_PerfFormattedData_PerfDisk_PhysicalDisk (string Name)
http://msdn.microsoft.com/en-us/library/aa394262(VS.85).aspx
i can associate all logical drives with the right physical drive
it is not impossible that there is an easier way to do this
it is possible to use this with in admin rights, there is no big difference
without admin rights
hPhysicalDriveIOCTL = CreateFile (driveName, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
with admin rights
hPhysicalDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE , NULL,
OPEN_EXISTING, 0, NULL);
it's just a drive that I can not get the right information on. the first drive on the sil 3114
i only get Vendor Id "SiImage".
but everest get all information right so i think there is a better way to get this information.">uituio[
|
|
|
|

|
Hi,
When i run My Project there is ERROR that
Could Not load file or assambly " DriveinfoEX.dll, 1.1.3326.15292 Culture=neutral,Public key token=1 or its dependensy. the application faild to start because its side by side configration is incorrect please see the application event log for more detail(Exception from HRESULT:0x800736B1)
Thanks & Regards
Form :-
Vikash Yadav
|
|
|
|

|
Sir, when I am compiling the DLL, the size of the driveinfoex.dll is 108 KB as I have not change any line of given source code...and your file size for DriveInfoEx.dll is only 76 KB ...
Why this difference has been occured? or please give me some of ideas for compiling this DLL to reduce the size from 108 KB...
Does the DLL support Windows Vista or not???
Thanks...
|
|
|
|

|
I downloaded the source code, i did a build of the whole soln, i wnat to make use of the dll only. i have a seperate application where in i want to use this dll . I am using VS2005 and framework is 2.0.
i get a error saying the assembly requires a string name. can you please suggest here what to do ?
remember i am using DriveInfoEx.dll as reference to my project.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Retrieve the physical Hard drive ID and other info using low level APIs like DeviceIOControl
| Type | Article |
| Licence | CPOL |
| First Posted | 29 Dec 2006 |
| Views | 423,687 |
| Downloads | 27,450 |
| Bookmarked | 153 times |
|
|