Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;---------------------------------------------
- ; uptime simple launcher
- ; Copyright (C) addhaloka
- ;---------------------------------------------
- format PE GUI 5.0
- entry start
- include 'win32w.inc'
- SWP_NOOWNERZORDER equ 200h
- HORIZONTAL_SIZE equ 242
- VERTICAL_SIZE equ 38
- BACKGROUND_RED equ 40h
- FOREGROUND_RED equ 4h
- FOREGROUND_BLUE equ 1h
- FOREGROUND_GREEN equ 2h
- FOREGROUND_INTENSITY equ 8h
- section '.text' code readable executable
- align 10h
- data import
- library kernel32,'KERNEL32.DLL',\
- user32,'USER32.DLL',\
- shell32,'SHELL32.DLL'
- include 'api/kernel32.inc'
- include 'api/user32.inc'
- include 'api/shell32.inc'
- end data
- align 10h
- sznoerr du 'uptime.exe not found!',0Dh,0Ah,'Please check location',0Dh,0Ah,'of launch!',0
- szvarerr du 'Unable to get %comspec% variable!',0Dh,0Ah,'Further work is impossible, bye :|',0
- szrunerr du 'Unable to create process cmd.exe!',0Dh,0Ah,'Further work is impossible, bye :|',0
- exe32 du 'uptime.exe',0
- wndclass du 'ConsoleWindowClass',0
- wndtitle du 'uptime',0
- param du '" /c "@echo off & cls & (uptime -s) & echo. & (uptime -p) & echo. & pause >NUL"',0
- comspec du '%comspec%',0
- szquote du 22h,0
- align 10h
- nothing_error:
- invoke MessageBox,0,sznoerr,0,MB_ICONERROR
- jmp loc_exit
- cmdvar_error:
- invoke MessageBox,0,szvarerr,0,MB_ICONERROR
- jmp loc_exit
- running_error:
- invoke MessageBox,0,szrunerr,0,MB_ICONERROR
- jmp loc_exit
- proc existW ucFileName:DWORD
- local ucwfd:WIN32_FIND_DATAW
- lea eax,[ucwfd]
- invoke FindFirstFileW,[ucFileName],eax
- cmp eax,-1
- je @F
- invoke FindClose,eax
- dec eax
- @@:
- inc eax
- ret
- endp
- start:
- invoke GetModuleFileName,0,curdir,MAX_PATH*2
- invoke lstrlen,curdir
- lea edi,[eax*2+curdir]
- @@:
- cmp word[edi],5Ch
- je @F
- dec edi
- jmp @B
- @@:
- mov word[edi+2],0
- invoke SetCurrentDirectory,curdir
- stdcall existW,exe32
- test eax,eax
- je nothing_error
- invoke ExpandEnvironmentStrings,comspec,cmdexe,MAX_PATH*2
- test eax,eax
- je cmdvar_error
- invoke lstrcpy,buffer,szquote
- invoke lstrcat,buffer,cmdexe
- invoke lstrcat,buffer,param
- mov [sinfo.cb],sizeof.STARTUPINFO
- mov [sinfo.lpTitle],wndtitle
- mov dword[sinfo.dwFlags], STARTF_USEFILLATTRIBUTE or STARTF_USECOUNTCHARS or STARTF_USEPOSITION or STARTF_USESIZE
- mov dword[sinfo.dwXSize],HORIZONTAL_SIZE
- mov dword[sinfo.dwYSize],VERTICAL_SIZE
- mov dword[sinfo.dwXCountChars],30
- mov dword[sinfo.dwYCountChars],3
- mov dword[sinfo.dwFillAttribute],BACKGROUND_RED or FOREGROUND_RED or FOREGROUND_GREEN or FOREGROUND_BLUE or FOREGROUND_INTENSITY
- invoke GetDesktopWindow
- invoke GetWindowRect,eax,rct
- test eax,eax
- je @F
- invoke GetSystemMetrics,SM_CXFULLSCREEN
- test eax,eax
- je @F
- mov ecx,rct.right
- sub ecx,rct.left-HORIZONTAL_SIZE
- sub eax,ecx
- shr eax,1
- mov [sinfo.dwX],eax
- invoke GetSystemMetrics,SM_CYFULLSCREEN
- test eax,eax
- je @F
- mov ecx,rct.bottom
- sub ecx,rct.top-VERTICAL_SIZE
- sub eax,ecx
- shr eax,1
- mov [sinfo.dwY],eax
- @@:
- invoke ShellExecute,0,0,0,0,0,0
- invoke CreateProcess,cmdexe,buffer,0,0,FALSE,0,0,curdir,sinfo,pinfo
- test eax,eax
- je running_error
- invoke WaitForInputIdle,[pinfo.hProcess],-1
- @@:
- invoke FindWindow,wndclass,wndtitle
- test eax,eax
- je @B
- mov [hwnd],eax
- invoke SetWindowPos,eax,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE or SWP_NOMOVE or SWP_NOOWNERZORDER
- invoke SetForegroundWindow,[hwnd]
- mov esi,5
- @@:
- invoke Sleep,3000
- invoke GetExitCodeProcess,[pinfo.hProcess],excode
- cmp [excode],STILL_ACTIVE
- jne @F
- dec esi
- jne @B
- jmp loc_close
- @@:
- invoke CloseHandle,[pinfo.hProcess]
- jmp loc_exit
- loc_close:
- invoke CloseHandle,[pinfo.hProcess]
- invoke PostMessage,[hwnd],WM_KEYDOWN,VK_SPACE,0
- loc_exit:
- invoke ExitProcess,0
- section '.data' readable writeable
- hwnd dd ?
- excode dd ?
- buffer du 1024 dup(?)
- curdir du MAX_PATH dup(?)
- cmdexe du MAX_PATH dup(?)
- rct RECT
- sinfo STARTUPINFO
- pinfo PROCESS_INFORMATION
- section '.rsrc' resource data readable
- directory RT_ICON,icons,\
- RT_GROUP_ICON,group_icons,\
- RT_VERSION,versions
- resource icons,\
- 1,409h,icon_data1,\
- 2,409h,icon_data2,\
- 3,409h,icon_data3,\
- 4,409h,icon_data4
- resource group_icons,\
- 100,409h,main_icon
- resource versions,\
- 1,409h,version
- icon main_icon,\
- icon_data1,'res/48x48.ico',\
- icon_data2,'res/32x32.ico',\
- icon_data3,'res/24x24.ico',\
- icon_data4,'res/16x16.ico'
- versioninfo version,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,409h,4B0h,\
- 'CompanyName','addhaloka',\
- 'FileDescription',<'PCL',27h,'s uptime launcher'>,\
- 'LegalCopyright',<0A9h,' 2017. No rights reserved.'>,\
- 'FileVersion','1.0.0.0'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement