C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 팁&트릭
C++Builder Programming Tip&Tricks
[91] [팁] PII 이상PC의 CPU Serial Number 얻기
김영욱 [] 9556 읽음    2001-04-18 10:32
안녕하세요 김영욱입니다.

보안또는 상용프로그램에서 Rock이 필요할때가 있습니다.
물론 H/W를 이용(Dongle Key)할수도 있고, 셋업될 PC의 시리얼 번호로
제어 할수도 있습니다.

밑의 내용은 볼랜드 포럼에 나온 내용이구요, 제가 VCL환경에서 작동하도록
약간 수정한 내용입니다.

참조하시길...


#pragma option -w-asc

#define VCL_IOSTREAM

#include <vcl.h>

#pragma hdrstop
#include <iostream.h>

#include "Unit1.h"
//---------------------------------------------------------------------------

#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
AnsiString __fastcall TForm1::GetSerialNum()
{
unsigned long FeatureFlags;
unsigned long SerialMostSignificantBits;
unsigned long SerialMiddleSignificantBits;
unsigned long SerialLeastSignificantBits;
AnsiString Information;

asm mov eax,1;

__emit__(0x0f);
__emit__(0xa2);

asm
{
  mov FeatureFlags, edx
  mov SerialMostSignificantBits, eax
  mov eax,3
}

__emit__(0x0f);
__emit__(0xa2);

asm
{
  mov SerialMiddleSignificantBits, edx
  mov SerialLeastSignificantBits, ecx
}

bool SerialEnabled = (FeatureFlags & 0x40000);

if(SerialEnabled)
{
  Information.sprintf("Feature flags: %X\n Serial : %.08X%.08X%.08X",
                       FeatureFlags,SerialMostSignificantBits,SerialMiddleSignificantBits,
                       SerialLeastSignificantBits);

}
else
  Information = "Serial number not available";

   return Information;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Label1->Caption = GetSerialNum();
}
//---------------------------------------------------------------------------

+ -

관련 글 리스트
91 [팁] PII 이상PC의 CPU Serial Number 얻기 김영욱 9556 2001/04/18
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.