Нужно привязать прогу конкретному ПК. Тобишь, к примеру, получить серийный номер винта и т.п. и на основании этого генерировать уникальный идентификационный ключ пользователя. Какие есть варианты? У меня мыслей много, но может есть что-нибудь более интересное. Да, кстати, еще очень желательно чтобы сам процесс получения этого "уникального" значения машины был достаточно простым в программировании и использовал только ф-ии из kernel32.dll (ну это уж вообще было бы здорово!) - такова специфика программы.
Я знаю что это уже двести раз делалось, но...
Если есть какой-нить код (не обязательно на ассемблере) или мысли - пишите.
ПРОБЛЕМА: Надо реализовать привязку к железу ПК
Модератор: Andy
*provided AS IS
Вот описание функции из kernel32.dll:
А вот пример:The GetVolumeInformation function returns information about a file system and volume whose root directory is specified.
BOOL GetVolumeInformation(
LPCTSTR lpRootPathName, // address of root directory of the file system
LPTSTR lpVolumeNameBuffer, // address of name of the volume
DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
LPDWORD lpVolumeSerialNumber, // address of volume serial number
LPDWORD lpMaximumComponentLength, // address of system's maximum filename length
LPDWORD lpFileSystemFlags, // address of file system flags
LPTSTR lpFileSystemNameBuffer, // address of name of file system
DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
);
Parameters
lpRootPathName
Points to a string that contains the root directory of the volume to be described. If this parameter is NULL, the root of the current directory is used. If this parameter is a UNC name, you must follow it with an additional backslash. For example, you would specify \\MyServer\MyShare as \\MyServer\MyShare\.
lpVolumeNameBuffer
Points to a buffer that receives the name of the specified volume.
nVolumeNameSize
Specifies the length, in characters, of the volume name buffer. This parameter is ignored if the volume name buffer is not supplied.
lpVolumeSerialNumber
Points to a variable that receives the volume serial number. This parameter can be NULL if the serial number is not required.
lpMaximumComponentLength
Points to a doubleword value that receives the maximum length, in characters, of a filename component supported by the specified file system. A filename component is that portion of a filename between backslashes.
The value stored in variable pointed to by *lpMaximumComponentLength is used to indicate that long names are supported by the specified file system. For example, for a FAT file system supporting long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the New Technology file system.
lpFileSystemFlags
Points to a doubleword that receives flags associated with the specified file system. This parameter can be any combination of the following flags, with one exception: FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED are mutually exclusive.
Value Meaning
FS_CASE_IS_PRESERVED If this flag is set, the file system preserves the case of filenames when it places a name on disk.
FS_CASE_SENSITIVE If this flag is set, the file system supports case-sensitive filenames.
FS_UNICODE_STORED_ON_DISK If this flag is set, the file system supports Unicode in filenames as they appear on disk.
FS_PERSISTENT_ACLS If this flag is set, the file system preserves and enforces ACLs. For example, NTFS preserves and enforces ACLs, and FAT does not.
FS_FILE_COMPRESSION The file system supports file-based compression.
FS_VOL_IS_COMPRESSED The specified volume is a compressed volume; for example, a DoubleSpace volume.
lpFileSystemNameBuffer
Points to a buffer that receives the name of the file system (such as FAT or NTFS).
nFileSystemNameSize
Specifies the length, in characters, of the file system name buffer. This parameter is ignored if the file system name buffer is not supplied.
Return Values
If all the requested information is retrieved, the return value is nonzero.
If not all the requested information is retrieved, the return value is zero. To get extended error information, call GetLastError.
Remarks
If you are attempting to obtain information about a floppy drive that does not have a floppy disk or a CD-ROM drive that does not have a compact disc, the system displays a message box asking the user to insert a floppy disk or a compact disc, respectively. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_FAILCRITICALERRORS.
The FS_VOL_IS_COMPRESSED flag is the only indicator of volume-based compression. The file system name is not altered to indicate compression. This flag comes back set on a DoubleSpace volume, for example. With volume-based compression, an entire volume is either compressed or not compressed.
The FS_FILE_COMPRESSION flag indicates whether a file system supports file-based compression. With file-based compression, individual files can be compressed or not compressed.
The FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED flags are mutually exclusive; both bits cannot come back set.
The maximum component length value, stored in the DWORD variable pointed to by lpMaximumComponentLength, is the only indicator that a volume supports longer-than-normal FAT (or other file system) file names. The file system name is not altered to indicate support for long file names.
The GetCompressedFileSize function obtains the compressed size of a file. The GetFileAttributes function can determine whether an individual file is compressed.
See Also
GetCompressedFileSize, GetFileAttributes, SetErrorMode, SetVolumeLabel
Код: Выделить всё
.
.
.
.data
.
.
.
SerialNum dw 0
a dw 0
b dw 0
buffer db 255 dup(0)
device db "c:\\"
.
.
.
invoke getVolumeInformation, addr device, addr buffer, sizeof buffer, addr SerialNum, addr a, addr b, 0, 0
.
.
.
И пусть удача повернется к тебе нужным местом 

вот еще одна функция, которая может тебя заинтересовать:
The GetSystemInfo function returns information about the current system.
VOID GetSystemInfo(
LPSYSTEM_INFO lpSystemInfo // address of system information structure
);
Parameters
lpSystemInfo
Points to a SYSTEM_INFO structure to be filled in by this function.
Return Values
This function does not return a value.
See Also
SYSTEM_INFO
The SYSTEM_INFO structure contains information about the current computer system. This includes the architecture and type of the processor, the number of processors in the system, the page size, and other such information.
typedef struct _SYSTEM_INFO { // sinf
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;
Members
dwOemId
An obsolete member that is retained for compatibility with previous versions of Windows NT. Beginning with Windows NT 3.51 and the initial release of Windows 95, use the wProcessorArchitecture branch of the union.
Windows 95: The system always sets this member to zero, the value defined for PROCESSOR_ARCHITECTURE_INTEL.
wProcessorArchitecture
Specifies the system's processor architecture. This value can be one of the following values:
Value
PROCESSOR_ARCHITECTURE_INTEL
Windows NT only: PROCESSOR_ARCHITECTURE_MIPS
Windows NT only: PROCESSOR_ARCHITECTURE_ALPHA
Windows NT only: PROCESSOR_ARCHITECTURE_PPC
Windows NT only: PROCESSOR_ARCHITECTURE_UNKNOWN
wReserved
Reserved for future use.
dwPageSize
Specifies the page size and the granularity of page protection and commitment. This is the page size used by the VirtualAlloc function.
lpMinimumApplicationAddress
Pointer to the lowest memory address accessible to applications and dynamic-link libraries (DLLs).
lpMaximumApplicationAddress
Pointer to the highest memory address accessible to applications and DLLs.
dwActiveProcessorMask
Specifies a mask representing the set of processors configured into the system. Bit 0 is processor 0; bit 31 is processor 31.
dwNumberOfProcessors
Specifies the number of processors in the system.
dwProcessorType
Windows 95:
Specifies the type of processor in the system.
Windows NT:
This member is no longer relevant, but is retained for compatibility with Windows 95 and previous versions of Windows NT. Use the wProcessorArchitecture, wProcessorLevel, and wProcessorRevision members to determine the type of processor.
This member is one of the following values:
Value
PROCESSOR_INTEL_386
PROCESSOR_INTEL_486
PROCESSOR_INTEL_PENTIUM
Windows NT only: PROCESSOR_MIPS_R4000
Windows NT only: PROCESSOR_ALPHA_21064
dwAllocationGranularity
Specifies the granularity with which virtual memory is allocated. For example, a VirtualAlloc request to allocate 1 byte will reserve an address space of dwAllocationGranularity bytes. This value was hard coded as 64K in the past, but other hardware architectures may require different values.
wProcessorLevel
Windows 95: This member is not used.
Windows NT: Specifies the system's architecture-dependent processor level.
If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_INTEL, wProcessorLevel can be one of the following values:
Value Meaning
3 Intel 80386
4 Intel 80486
5 Pentium
If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_MIPS, wProcessorLevel is of the form 00xx, where xx is an 8-bit implementation number (bits 8-15 of the PRId register). The member can be the following value:
Value Meaning
0004 MIPS R4000
If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_ALPHA, wProcessorLevel is of the form xxxx, where xxxx is a 16-bit processor version number (the low-order 16 bits of a version number from the firmware). The member can be one of the following values:
Decimal Value Meaning
21064 Alpha 21064
21066 Alpha 21066
21164 Alpha 21164
If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_PPC, wProcessorLevel is of the form xxxx, where xxxx is a 16-bit processor version number (the high-order 16 bits of the Processor Version Register). The member can be one of the following values:
Decimal Value Meaning
1 PPC 601
3 PPC 603
4 PPC 604
6 PPC 603+
9 PPC 604+
20 PPC 620
wProcessorRevision
Windows 95: This member is not used.
Windows NT: Specifies an architecture-dependent processor revision. The following table shows how the revision value is assembled for each type of processor architecture.
Processor Architecture Value
Intel 80386 or 80486 A value of the form xxyz. If xx is equal to 0xFF, y - 0xA is the model number, and z is the stepping identifier. For example, an Intel 80486-D0 system returns 0xFFD0.If xx is not equal to 0xFF, xx + 'A' is the stepping letter and yz is the minor stepping.
Intel Pentium,
Cyrix, or
NextGen 586 A value of the form xxyy, where xx is the model number and yy is the stepping. For example, a value of 0x0201 indicates Model 2, Stepping 1.
MIPS A value of the form 00xx, where xx is the 8-bit revision number of the processor (the low-order 8 bits of the PRId register).
ALPHA A value of the form xxyy, where xxyy is the low-order 16 bits of the processor revision number from the firmware. Display this value as follows: Model 'A'+xx, Pass yy
PPC A value of the form xxyy, where xxyy is the low-order 16 bits of the Processor Version Register. Display this value as a fixed point number:xx.yy
Remarks
Beginning with Windows NT 3.51 and the initial release of Windows 95, the SYSTEM_INFO structure has changed as follows:
· The dwOemId member has been changed to a union. The union supports a new way to describe processor architecture used by Windows NT, while maintaining compatibility with Windows 95 and previous versions of Windows NT.
· The dwProcessorType member is now obsolete on Windows NT. It is still used on Windows 95.
· A previously reserved DWORD member at the end of the structure has been replaced by the wProcessorLevel and wProcessorRevision members. Windows 95 does not use these members.
See Also
GetSystemInfo, MapViewOfFile, MapViewOfFileEx
И пусть удача повернется к тебе нужным местом 

А вот пример на C++ из win32.hlp:
The following example uses the GetSystemInfo function to obtain hardware information such as the OEM identifier, processor type, page size, and so on. The example displays the information in a window's client area.
SYSTEM_INFO siSysInfo; // struct. for hardware information
int aTabs[1] = {260}; // tab stop for TabbedTextOut
TCHAR tchBuffer[BUFFER]; // buffer for expanded string
int nSize; // size of string
// Display the "hardware information" header.
nSize = sprintf(tchBuffer,
"Hardware information:");
TextOut(hdc, 15, 20, tchBuffer, nSize);
// Copy the hardware information to the SYSTEM_INFO structure.
GetSystemInfo(&siSysInfo);
// Display the contents of the SYSTEM_INFO structure.
nSize = sprintf(tchBuffer,
"OEM ID: %u\tNumber of Processors: %u",
siSysInfo.dwOemId,
siSysInfo.dwNumberOfProcessors);
TabbedTextOut(hdc, 25, 40, tchBuffer,
nSize, 1, aTabs, 25);
nSize = sprintf(tchBuffer,
"Page size: %u\tProcessor Type: %u",
siSysInfo.dwPageSize,
siSysInfo.dwProcessorType);
TabbedTextOut(hdc, 25, 60, tchBuffer,
nSize, 1, aTabs, 25);
nSize = sprintf(tchBuffer,
"Minimum app address: %lx\tMaximum app address: %lx",
siSysInfo.lpMinimumApplicationAddress,
siSysInfo.lpMaximumApplicationAddress);
TabbedTextOut(hdc, 25, 80, tchBuffer,
nSize, 1, aTabs, 25);
nSize = sprintf(tchBuffer,
"Active processor mask: %u",
siSysInfo.dwActiveProcessorMask);
TextOut(hdc, 25, 100, tchBuffer, nSize);
И пусть удача повернется к тебе нужным местом 
