这里没有商品信息,需要自己编码添加。
#include
#include
typedefstructln//会员信息
{
charid[20];//会员账号
charkey[20];//会员密码
intsum;//会员积分
structlnnext;
}member;
structlm//商品信息
{
intid;//商品编号
charname[50];//商品名称
intstock;//商品库存
}goods[1000];
memberregiste(membert);//注册;
voidbuy();
intmain()
{
memberhead=(member)malloc(sizeof(member));
strcpy(head->id,"0"),strcpy(head->key,"0");//超市管理员
head->next=NULL;
inti,a,n,boo=0;
while(1)
{
printf("注册会员请按1:");
printf("会员直接登录请按2:");
printf("退出请按0:");
scanf("%d",&a);
if(a==0)break;
if(a==1)head=registe(head);
elseif(a==2)boo=login(head);
if(boo)break;
}
if(a&&boo==1)
{
printf("尊贵的会员,您登录成功!");
buy();
}
printf("已经安全退出");
}
memberregiste(membert)//注册
{
printf("现在开始会员注册");
charid[20],key[20];
memberp,q,r;
p=t;
while(p->next)p=p->next;//寻找链表中最后一个结点
while(1)
{
printf("请输入您注册的账号,密码:");
scanf("%s%s",id,key);
q=t;
while(q)//判断该账号是否已经被注册
{
if(strcmp(q->id,id)==0)break;
elseq=q->next;
}
if(q==NULL)//账号没有注册
{
r=(member)malloc(sizeof(member));
r->next=NULL;
p->next=r;
strcpy(r->id,id);
strcpy(r->key,key);
r->sum=1000;//会员默认的积分为1000
break;
}
elseprintf("该账号已被注册,请重新输入账号,密码");
}
printf("恭喜您,已经注册成功。现在可以登录了");
returnt;
}
intlogin(membert)//登录
{
printf("现在开始登录");
memberp;
charid[20],key[20];
inta,boo=0;
while(1)
{
printf("请输入您的账号,密码:");
scanf("%s",id);
if(strcmp(id,"#")==0)break;
scanf("%s",key);
p=t;
while(p)
{
if(strcmp(p->id,id)==0&&strcmp(p->key,key)==0)break;
elsep=p->next;
}
if(p==NULL)
{
printf("对不起,该账号不存在或密码错误。请重新登录");
printf("退出登录请按#");
}
elseif(strcmp(id,"0")!=0)
{
boo=1;
break;
}
}
returnboo;
}
voidbuy()
{
chars[20];
intn,i;
while(1)
{
printf("请输入商品的编号或者名称:");
scanf("%s",s);
if(strcmp(s,"0")==0)break;
if(s[0]>='1'&&s[0]
{
n=atoi(s);
for(i=0;i
{
if(goods[i]id==n)break;
}
if(i>=1000)
{
printf("商品不存在请重新输入,退出请按0");
}
else
{
printf("您已购买成功。");
}
}
else
{
for(i=0;i
{
if(strcmp(goods[i],s)==0)break;
}
if(i>=1000)
{
printf("商品不存在请重新输入,退出请按0");
}
else
{
printf("您已购买成功。");
}
}
}
}
1安装应用到手机A,获取UUID,UUID字符串是:5115e5a0a5464fcca1445fdb73e528b8,同时把UUID保存到钥匙串。
2卸载应用重新安装,获取钥匙串里保存的UUID是否有值。通过测试验证,钥匙串里有对应保存的UUID,并且UUID字符串是:5115e5a0a5464fcca1445fdb73e528b8(同第1步保存的一样)。
3反复卸载、安装进行多次,得到的结果(同第2步一样)。
4恢复出厂设置(跟着提示进行就行,有点繁琐)
41把手机恢复出厂设置(抹掉所有内容和设置),抹掉时不进行备份 *** 作,选择立即抹掉。
42进行重新设置手机,设置手机时有一步骤是选择恢复备份的界面,选择设置新的iPhone。(就是不选择恢复备份的iCloud备份的数据)。
5完成第4步以后,手机恢复正常使用。在进行安装应用到手机A。这时,通过测试验证钥匙串里已经没有了之前保存的UUID。这时是重新获取一个新的UUID进行保存到Keychain(钥匙串),UUID字符串是:e56b79c897c847dc82461bad40937cbd。
6这时把iCloud里的钥匙串打开,进行iCloud数据备份。
7再次进行恢复出厂设置(换个方式进行)
71把手机恢复出厂设置(抹掉所有内容和设置),抹掉时进行备份 *** 作,备份以后进行抹掉。
72进行重新设置手机,设置手机时有一步骤是选择恢复备份的界面,这时选择恢复iCloud备份的数据。
8在次进行安装应用到手机A。这时,通过测试验证,钥匙串里有对应保存的UUID,并且UUID字符串是:e56b79c897c847dc82461bad40937cbd(同第5步保存的一样)。
1打开手机的iCloud云盘进行数据备份
2打开iCloud里的钥匙串选项
3在重新恢复出厂设置的时候(抹掉所有内容和设置),要选择iCloud备份的数据后,在进行抹掉 *** 作。
4在重新设置手机的时候要保证填写iCloud备份是时对应的iCloud账号(第3步的iCloud账号)。
5要选择iCloud备份数据恢复设置。
6不能对手机进行刷机 *** 作。
(通过测试,我个人认为,手机本人刷机后(非一般 *** 作),重新开机,填写iCloud账号同一个的情况下,也可以恢复钥匙串,得到用户应用和设备的唯一性)。
首先需添加对SystemManagement的引用。
[c-sharp] view plain copy
using System;
using SystemRuntimeInteropServices;
using SystemManagement;
namespace Hardware
{
/// <summary>
/// HardwareInfo 的摘要说明。
/// </summary>
public class HardwareInfo
{
//取机器名
public string GetHostName()
{
return SystemNetDnsGetHostName();
}
//取CPU编号
public String GetCpuID()
{
try
{
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mcGetInstances();
String strCpuID = null;
foreach (ManagementObject mo in moc)
{
strCpuID = moProperties["ProcessorId"]ValueToString();
break;
}
return strCpuID;
}
catch
{
return "";
}
}//end method
//取第一块硬盘编号
public String GetHardDiskID()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT FROM Win32_PhysicalMedia");
String strHardDiskID = null;
foreach (ManagementObject mo in searcherGet())
{
strHardDiskID = mo["SerialNumber"]ToString()Trim();
break;
}
return strHardDiskID;
}
catch
{
return "";
}
}//end
public enum NCBCONST
{
NCBNAMSZ = 16, / absolute length of a net name /
MAX_LANA = 254, / lana's in range 0 to MAX_LANA inclusive /
NCBENUM = 0x37, / NCB ENUMERATE LANA NUMBERS /
NRC_GOODRET = 0x00, / good return /
NCBRESET = 0x32, / NCB RESET /
NCBASTAT = 0x33, / NCB ADAPTER STATUS /
NUM_NAMEBUF = 30, / Number of NAME's BUFFER /
}
[StructLayout(LayoutKindSequential)]
public struct ADAPTER_STATUS
{
[MarshalAs(UnmanagedTypeByValArray, SizeConst = 6)]
public byte[] adapter_address;
public byte rev_major;
public byte reserved0;
public byte adapter_type;
public byte rev_minor;
public ushort duration;
public ushort frmr_recv;
public ushort frmr_xmit;
public ushort iframe_recv_err;
public ushort xmit_aborts;
public uint xmit_success;
public uint recv_success;
public ushort iframe_xmit_err;
public ushort recv_buff_unavail;
public ushort t1_timeouts;
public ushort ti_timeouts;
public uint reserved1;
public ushort free_ncbs;
public ushort max_cfg_ncbs;
public ushort max_ncbs;
public ushort xmit_buf_unavail;
public ushort max_dgram_size;
public ushort pending_sess;
public ushort max_cfg_sess;
public ushort max_sess;
public ushort max_sess_pkt_size;
public ushort name_count;
}
[StructLayout(LayoutKindSequential)]
public struct NAME_BUFFER
{
[MarshalAs(UnmanagedTypeByValArray, SizeConst = (int)NCBCONSTNCBNAMSZ)]
public byte[] name;
public byte name_num;
public byte name_flags;
}
[StructLayout(LayoutKindSequential)]
public struct NCB
{
public byte ncb_command;
public byte ncb_retcode;
public byte ncb_lsn;
public byte ncb_num;
public IntPtr ncb_buffer;
public ushort ncb_length;
[MarshalAs(UnmanagedTypeByValArray, SizeConst = (int)NCBCONSTNCBNAMSZ)]
public byte[] ncb_callname;
[MarshalAs(UnmanagedTypeByValArray, SizeConst = (int)NCBCONSTNCBNAMSZ)]
public byte[] ncb_name;
public byte ncb_rto;
public byte ncb_sto;
public IntPtr ncb_post;
public byte ncb_lana_num;
public byte ncb_cmd_cplt;
[MarshalAs(UnmanagedTypeByValArray, SizeConst = 10)]
public byte[] ncb_reserve;
public IntPtr ncb_event;
}
[StructLayout(LayoutKindSequential)]
public struct LANA_ENUM
{
public byte length;
[MarshalAs(UnmanagedTypeByValArray, SizeConst = (int)NCBCONSTMAX_LANA)]
public byte[] lana;
}
[StructLayout(LayoutKindAuto)]
public struct ASTAT
{
public ADAPTER_STATUS adapt;
[MarshalAs(UnmanagedTypeByValArray, SizeConst = (int)NCBCONSTNUM_NAMEBUF)]
public NAME_BUFFER[] NameBuff;
}
public class Win32API
{
[DllImport("NETAPI32DLL")]
public static extern char Netbios(ref NCB ncb);
}
public string GetMacAddress()
{
string addr = "";
try
{
int cb;
ASTAT adapter;
NCB Ncb = new NCB();
char uRetCode;
LANA_ENUM lenum;
Ncbncb_command = (byte)NCBCONSTNCBENUM;
cb = MarshalSizeOf(typeof(LANA_ENUM));
Ncbncb_buffer = MarshalAllocHGlobal(cb);
Ncbncb_length = (ushort)cb;
uRetCode = Win32APINetbios(ref Ncb);
lenum = (LANA_ENUM)MarshalPtrToStructure(Ncbncb_buffer, typeof(LANA_ENUM));
MarshalFreeHGlobal(Ncbncb_buffer);
if (uRetCode != (short)NCBCONSTNRC_GOODRET)
return "";
for (int i = 0; i < lenumlength; i++)
{
Ncbncb_command = (byte)NCBCONSTNCBRESET;
Ncbncb_lana_num = lenumlana[i];
uRetCode = Win32APINetbios(ref Ncb);
if (uRetCode != (short)NCBCONSTNRC_GOODRET)
return "";
Ncbncb_command = (byte)NCBCONSTNCBASTAT;
Ncbncb_lana_num = lenumlana[i];
Ncbncb_callname[0] = (byte)'';
cb = MarshalSizeOf(typeof(ADAPTER_STATUS)) + MarshalSizeOf(typeof(NAME_BUFFER)) (int)NCBCONSTNUM_NAMEBUF;
Ncbncb_buffer = MarshalAllocHGlobal(cb);
Ncbncb_length = (ushort)cb;
uRetCode = Win32APINetbios(ref Ncb);
adapteradapt = (ADAPTER_STATUS)MarshalPtrToStructure(Ncbncb_buffer, typeof(ADAPTER_STATUS));
MarshalFreeHGlobal(Ncbncb_buffer);
if (uRetCode == (short)NCBCONSTNRC_GOODRET)
{
if (i > 0)
addr += ":";
addr = stringFormat("{0,2:X}{1,2:X}{2,2:X}{3,2:X}{4,2:X}{5,2:X}",
adapteradaptadapter_address[0],
adapteradaptadapter_address[1],
adapteradaptadapter_address[2],
adapteradaptadapter_address[3],
adapteradaptadapter_address[4],
adapteradaptadapter_address[5]);
}
}
}
catch
{ }
return addrReplace(' ', '0');
}
}
}
使用方法举例:
[c-sharp] view plain copy
//获取硬盘序列号
HardwareHardwareInfo hardwareInfo = new HardwareHardwareInfo();
string hardDiskID = hardwareInfoGetHardDiskID();
SystemConsoleWriteLine(hardDiskID);
//获取CPU序列号
string cpuID = hardwareInfoGetCpuID();
SystemConsoleWriteLine(cpuID);
//获取硬盘序列号HardwareHardwareInfo hardwareInfo = new HardwareHardwareInfo();string hardDiskID = hardwareInfoGetHardDiskID();SystemConsoleWriteLine(hardDiskID);//获取CPU序列号string cpuID = hardwareInfoGetCpuID();SystemConsoleWriteLine(cpuID);
这样写。
int id = 0;
if($("#userSearchBar")val()=='loginName')
id = $("#a")val(),
attrValue: $("#searchCondition")val()
}
<div class="easyui-panel" data-options="fit:true" title="用户查询" style="padding-bottom:20px;">
<div id="userSearchBar" >
<select>
<option value="loginName" id="a">用户名</option>
<option value="name" id="b">姓名</option>
<option value="idcard" id="c">描述</option>
</select>
你就可以获取id啦
>
string str1 = null;
ManagementClass mcHD = new ManagementClass("win32_logicaldisk");
ManagementObjectCollection mocHD = mcHDGetInstances();
foreach (ManagementObject m in mocHD)
{
if (m["DeviceID"]ToString() == "C:")//获取的是C盘,可以任意更改
{
str1 = mProperties["VolumeSerialNumber"]ValueToString();
break;
}
}
ConsoleWriteLine(str1);
可以获取, 但不能修改
// “获得Intel CPU ID”按钮消息处理函数
void CIntelCPUIDDlg::OnBtnCPUID()
{
unsigned long s1,s2;
unsigned char vendor_id[]="------------";//CPU提供商ID
CString str1,str2,str3;
// 以下为获得CPU ID的汇编语言指令
_asm // 得到CPU提供商信息
{
xor eax,eax // 将eax清0
cpuid // 获取CPUID的指令
mov dword ptr vendor_id,ebx
mov dword ptr vendor_id[+4],edx
mov dword ptr vendor_id[+8],ecx
}
str1Format("%s",vendor_id);
_asm // 得到CPU ID的高32位
{
mov eax,01h
xor edx,edx
cpuid
mov s2,eax
}
str2Format("%08X-",s2);
_asm // 得到CPU ID的低64位
{
mov eax,03h
xor ecx,ecx
xor edx,edx
cpuid
mov s1,edx
mov s2,ecx
}
str3Format("%08X-%08X\n",s1,s2);
str2=str2+str3;
m_editVendorSetWindowText(str1);
m_editCPUIDSetWindowText(str2);
}
// GetHDSerialcpp: implementation of the CGetHDSerial class
//
//////////////////////////////////////////////////////////////////////
#include "stdafxh"
#include "GetHDSerialh"
char m_buffer[256];
WORD m_serial[256];
DWORD m_OldInterruptAddress;
DWORDLONG m_IDTR;
// 等待硬盘空闲
static unsigned int WaitHardDiskIdle()
{
BYTE byTemp;
Waiting:
_asm
{
mov dx, 0x1f7
in al, dx
cmp al, 0x80
jb Endwaiting
jmp Waiting
}
Endwaiting:
_asm
{
mov byTemp, al
}
return byTemp;
}
//中断服务程序
void _declspec( naked )InterruptProcess(void)
{
int byTemp;
int i;
WORD temp;
//保存寄存器值
_asm
{
push eax
push ebx
push ecx
push edx
push esi
}
WaitHardDiskIdle();//等待硬盘空闲状态
_asm
{
mov dx, 0x1f6
mov al, 0xa0
out dx, al
}
byTemp = WaitHardDiskIdle(); //若直接在Ring3级执行等待命令,会进入死循环
if ((byTemp&0x50)!=0x50)
{
_asm // 恢复中断现场并退出中断服务程序
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}
_asm
{
mov dx, 0x1f6 //命令端口1f6,选择驱动器0
mov al, 0xa0
out dx, al
inc dx
mov al, 0xec
out dx, al //发送读驱动器参数命令
}
byTemp = WaitHardDiskIdle();
if ((byTemp&0x58)!=0x58)
{
_asm // 恢复中断现场并退出中断服务程序
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}
//读取硬盘控制器的全部信息
for (i=0;i<256;i++)
{
_asm
{
mov dx, 0x1f0
in ax, dx
mov temp, ax
}
m_serial[i] = temp;
}
_asm
{
pop esi
pop edx
pop ecx
pop ebx
pop eax
iretd
}
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGetHDSerial::CGetHDSerial()
{
}
CGetHDSerial::~CGetHDSerial()
{
}
// 读取硬盘序列号函数
char CGetHDSerial::GetHDSerial()
{
m_buffer[0]='\n';
// 得到当前 *** 作系统版本
OSVERSIONINFO OSVersionInfo;
OSVersionInfodwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx( &OSVersionInfo);
if (OSVersionInfodwPlatformId != VER_PLATFORM_WIN32_NT)
{
// Windows 9x/ME下读取硬盘序列号
WORD m_wWin9xHDSerial[256];
Win9xReadHDSerial(m_wWin9xHDSerial);
strcpy (m_buffer, WORDToChar (m_wWin9xHDSerial, 10, 19));
}
else
{
// Windows NT/2000/XP下读取硬盘序列号
DWORD m_wWinNTHDSerial[256];
// 判断是否有SCSI硬盘
if ( ! WinNTReadIDEHDSerial(m_wWinNTHDSerial))
WinNTReadSCSIHDSerial(m_wWinNTHDSerial);
strcpy (m_buffer, DWORDToChar (m_wWinNTHDSerial, 10, 19));
}
return m_buffer;
}
// Windows9X/ME系统下读取硬盘序列号
void _stdcall CGetHDSerial::Win9xReadHDSerial(WORD buffer)
{
int i;
for(i=0;i<256;i++)
buffer[i]=0;
_asm
{
push eax
//获取修改的中断的中断描述符(中断门)地址
sidt m_IDTR
mov eax,dword ptr [m_IDTR+02h]
add eax,308h+04h
cli
//保存原先的中断入口地址
push ecx
mov ecx,dword ptr [eax]
mov cx,word ptr [eax-04h]
mov dword ptr m_OldInterruptAddress,ecx
pop ecx
//设置修改的中断入口地址为新的中断处理程序入口地址
push ebx
lea ebx,InterruptProcess
mov word ptr [eax-04h],bx
shr ebx,10h
mov word ptr [eax+02h],bx
pop ebx
//执行中断,转到Ring 0(类似CIH病毒原理)
int 3h
//恢复原先的中断入口地址
push ecx
mov ecx,dword ptr m_OldInterruptAddress
mov word ptr [eax-04h],cx
shr ecx,10h
mov word ptr [eax+02h],cx
pop ecx
sti
pop eax
}
for(i=0;i<256;i++)
buffer[i]=m_serial[i];
}
// Windows 9x/ME系统下,将字类型(WORD)的硬盘信息转换为字符类型(char)
char CGetHDSerial::WORDToChar (WORD diskdata [256], int firstIndex, int lastIndex)
{
static char string [1024];
int index = 0;
int position = 0;
// 按照高字节在前,低字节在后的顺序将字数组diskdata 中内容存入到字符串string中
for (index = firstIndex; index <= lastIndex; index++)
{
// 存入字中的高字节
string [position] = (char) (diskdata [index] / 256);
position++;
// 存入字中的低字节
string [position] = (char) (diskdata [index] % 256);
position++;
}
// 添加字符串结束标志
string [position] = '\0';
// 删除字符串中空格
for (index = position - 1; index > 0 && ' ' == string [index]; index--)
string [index] = '\0';
return string;
}
// Windows NT/2000/XP系统下,将双字类型(DWORD)的硬盘信息转换为字符类型(char)
char CGetHDSerial::DWORDToChar (DWORD diskdata [256], int firstIndex, int lastIndex)
{
static char string [1024];
int index = 0;
int position = 0;
// 按照高字节在前,低字节在后的顺序将双字中的低字存入到字符串string中
for (index = firstIndex; index <= lastIndex; index++)
{
// 存入低字中的高字节
string [position] = (char) (diskdata [index] / 256);
position++;
// 存入低字中的低字节
string [position] = (char) (diskdata [index] % 256);
position++;
}
// 添加字符串结束标志
string [position] = '\0';
// 删除字符串中空格
for (index = position - 1; index > 0 && ' ' == string [index]; index--)
string [index] = '\0';
return string;
}
// Windows NT/2000/XP下读取IDE硬盘序列号
BOOL CGetHDSerial::WinNTReadIDEHDSerial(DWORD buffer)
{
BYTE IdOutCmd [sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1];
BOOL bFlag = FALSE;
int drive = 0;
char driveName [256];
HANDLE hPhysicalDriveIOCTL = 0;
sprintf (driveName, "\\\\\\PhysicalDrive%d", drive);
// Windows NT/2000/XP下创建文件需要管理员权限
hPhysicalDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
if (hPhysicalDriveIOCTL != INVALID_HANDLE_VALUE)
{
GETVERSIONOUTPARAMS VersionParams;
DWORD cbBytesReturned = 0;
// 得到驱动器的IO控制器版本
memset ((void) &VersionParams, 0, sizeof(VersionParams));
if(DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_GET_VERSION,
NULL, 0, &VersionParams,
sizeof(VersionParams),
&cbBytesReturned, NULL) )
{
if (VersionParamsbIDEDeviceMap > 0)
{
BYTE bIDCmd = 0; // IDE或者ATAPI识别命令
SENDCMDINPARAMS scip;
// 如果驱动器是光驱,采用命令IDE_ATAPI_IDENTIFY, command,
// 否则采用命令IDE_ATA_IDENTIFY读取驱动器信息
bIDCmd = (VersionParamsbIDEDeviceMap >> drive & 0x10)
IDE_ATAPI_IDENTIFY : IDE_ATA_IDENTIFY;
memset (&scip, 0, sizeof(scip));
memset (IdOutCmd, 0, sizeof(IdOutCmd));
// 获取驱动器信息
if (WinNTGetIDEHDInfo (hPhysicalDriveIOCTL,
&scip,
(PSENDCMDOUTPARAMS)&IdOutCmd,
(BYTE) bIDCmd,
(BYTE) drive,
&cbBytesReturned))
{
int m = 0;
USHORT pIdSector = (USHORT )
((PSENDCMDOUTPARAMS) IdOutCmd) -> bBuffer;
for (m = 0; m < 256; m++)
buffer[m] = pIdSector [m];
bFlag = TRUE; // 读取硬盘信息成功
}
}
}
CloseHandle (hPhysicalDriveIOCTL); // 关闭句柄
}
return bFlag;
}
// WindowsNT/2000/XP系统下读取SCSI硬盘序列号
BOOL CGetHDSerial::WinNTReadSCSIHDSerial (DWORD buffer)
{
buffer[0]='\n';
int controller = 0;
HANDLE hScsiDriveIOCTL = 0;
char driveName [256];
sprintf (driveName, "\\\\\\Scsi%d:", controller);
// Windows NT/2000/XP下任何权限都可以进行
hScsiDriveIOCTL = CreateFile (driveName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, 0, NULL);
if (hScsiDriveIOCTL != INVALID_HANDLE_VALUE)
{
int drive = 0;
DWORD dummy;
for (drive = 0; drive < 2; drive++)
{
char buffer [sizeof (SRB_IO_CONTROL) + SENDIDLENGTH];
SRB_IO_CONTROL p = (SRB_IO_CONTROL ) buffer;
SENDCMDINPARAMS pin =
(SENDCMDINPARAMS ) (buffer + sizeof (SRB_IO_CONTROL));
// 准备参数
memset (buffer, 0, sizeof (buffer));
p -> HeaderLength = sizeof (SRB_IO_CONTROL);
p -> Timeout = 10000;
p -> Length = SENDIDLENGTH;
p -> ControlCode = IOCTL_SCSI_MINIPORT_IDENTIFY;
strncpy ((char ) p -> Signature, "SCSIDISK", 8);
pin -> irDriveRegsbCommandReg = IDE_ATA_IDENTIFY;
pin -> bDriveNumber = drive;
// 得到SCSI硬盘信息
if (DeviceIoControl (hScsiDriveIOCTL, IOCTL_SCSI_MINIPORT,
buffer,
sizeof (SRB_IO_CONTROL) +
sizeof (SENDCMDINPARAMS) - 1,
buffer,
sizeof (SRB_IO_CONTROL) + SENDIDLENGTH,
&dummy, NULL))
{
SENDCMDOUTPARAMS pOut =
(SENDCMDOUTPARAMS ) (buffer + sizeof (SRB_IO_CONTROL));
IDSECTOR pId = (IDSECTOR ) (pOut -> bBuffer);
if (pId -> sModelNumber [0])
{
int n = 0;
USHORT pIdSector = (USHORT ) pId;
for (n = 0; n < 256; n++)
buffer[n] =pIdSector [n];
return TRUE; // 读取成功
}
}
}
CloseHandle (hScsiDriveIOCTL); // 关闭句柄
}
return FALSE; // 读取失败
}
// Windows NT/2000/XP下读取IDE设备信息
BOOL CGetHDSerial::WinNTGetIDEHDInfo (HANDLE hPhysicalDriveIOCTL, PSENDCMDINPARAMS pSCIP,
PSENDCMDOUTPARAMS pSCOP, BYTE bIDCmd, BYTE bDriveNum,
PDWORD lpcbBytesReturned)
{
// 为读取设备信息准备参数
pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;
pSCIP -> irDriveRegsbFeaturesReg = 0;
pSCIP -> irDriveRegsbSectorCountReg = 1;
pSCIP -> irDriveRegsbSectorNumberReg = 1;
pSCIP -> irDriveRegsbCylLowReg = 0;
pSCIP -> irDriveRegsbCylHighReg = 0;
// 计算驱动器位置
pSCIP -> irDriveRegsbDriveHeadReg = 0xA0 | ((bDriveNum & 1) << 4);
// 设置读取命令
pSCIP -> irDriveRegsbCommandReg = bIDCmd;
pSCIP -> bDriveNumber = bDriveNum;
pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;
// 读取驱动器信息
return ( DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_GET_DRIVE_INFO,
(LPVOID) pSCIP,
sizeof(SENDCMDINPARAMS) - 1,
(LPVOID) pSCOP,
sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1,
lpcbBytesReturned, NULL) );
}
以上就是关于C语言编写超市收银系统_c语言超市收银台程序全部的内容,包括:C语言编写超市收银系统_c语言超市收银台程序、iOS利用keychain钥匙串绑定设备UUID 来追踪用户的唯一ID、如何破解c#获取cpu id代码等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)