Форум: "Основная";
Текущий архив: 2002.01.28;
Скачать: [xml.tar.bz2];
ВнизВопрос о привязке проги к компу Найти похожие ветки
← →
MARcoDEN (2002-01-10 08:59) [11]Вот еще один вариант - определять дату BIOS:
type Ts=array[0..7] of char;
var s:TS;
p:^TS;
begin
s:="";
p:=@s;
asm
push esi
push edi
push ecx
Или тактовую частоту проца:
function GetCPUSpeed: Double;
const
DelayTime = 500; // measure time in ms
var
TimerHi, TimerLo: DWORD;
PriorityClass, Priority: Integer;
begin
PriorityClass := GetPriorityClass(GetCurrentProcess);
Priority := GetThreadPriority(GetCurrentThread);
SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL);
Sleep(10);
asm
dw 310Fh // rdtsc
mov TimerLo, eax
mov TimerHi, edx
end;
Sleep(DelayTime);
asm
dw 310Fh // rdtsc
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx
end;
SetThreadPriority(GetCurrentThread, Priority);
SetPriorityClass(GetCurrentProcess, PriorityClass);
Result := TimerLo / (1000.0 * DelayTime);
end;
begin
LabelCPUSpeed.Caption := Format("CPU speed: %f MHz", [GetCPUSpeed]);
end;
mov esi,$0ffff5
mov edi,p
mov cx,8
@@1:mov al,[esi]
mov [edi],al
inc edi
inc esi
loop @@1
pop ecx
pop edi
pop esi
end;
Form1.Label1.Caption:=s;
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.01.28;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.004 c