Skip to content

Instantly share code, notes, and snippets.

View sinitcin's full-sized avatar
🏠
Working from home

Anton Sinitsyn sinitcin

🏠
Working from home
View GitHub Profile
@sinitcin
sinitcin / lor1.rs
Created September 25, 2017 11:09
LOR1
#[derive(Debug, Default, Clone, Copy)]
struct LexerT<'a> {
pos: usize,
text: &'a str,
token: &'a str,
}
fn next_token(state: LexerT) -> Option<LexerT> {
let mut start_pos = 0;
let mut end_pos = start_pos;
macro array_data_record [arg]
{
db arg
}
macro array name, [arg]
{
common
name:
array_data_record arg
* seh64.inc
macro enqueue list,item
{ match any,list \{ list equ list,item \}
match ,list \{ list equ item \} }
macro dequeue list,item
{ done@dequeue equ
match first=,rest,list
\{ item equ first
section '.data' data readable writable
class.form db 'STORAGE',0
title.form db 'Главное окно',0
hinstance dd ?
rc RECT
msg MSG
wc WNDCLASS
section '.code' code readable executable
macro RGB red, green, blue
{
xor eax, eax
mov al, blue ; blue
rol eax, 8
mov al, green ; green
rol eax, 8
mov al, red ; red
}
format PE native 5.02 at 10000h
entry start
include 'win32a.inc'
section '.text' code readable executable
start:
push UNICODE_STRING
; Устанавливаем адрес обработчика
push exception
push dword [fs:0]
mov [fs:0],esp
; Исключение
xor eax,eax
mov [eax],1
; Если всё прошло отлично, то снимаем обработчик