News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

LCIDDATA.EXE

Started by herge, October 12, 2015, 07:09:56 PM

Previous topic - Next topic

herge

 A small EXE that tells the LCID for a country.
Source  Data Source Copyright 2015 Microsoft
Data Source http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

Code for LCIDDATA.ASM

;REM LCIDDATA.ASM Friday,September 06,2013 5:36:22 AM
;Last Edited Monday, October 12, 2015 8:31:07 AM
;
;Data Source http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx
; Copyright Microsoft 2015
        include \masm32\include\masm32rt.inc
;
;Remove Zero At End of Buffer MACRO. X is End or Exit
;
remzeroXbuf MACRO BufName:REQ
        lea esi,offset BufName
        add esi,eax
        mov byte ptr [ esi-1 ]," "
        ENDM
GetTimeZoneName MACRO ZoneName:REQ
        add esi,eax
        dec esi
        mov byte ptr [ esi  ] ," " ;Space
        mov edi,offset ZoneName
        xchg esi,edi
        call LoadAndStore
        ENDM
.code
    align 8
    public ECX_TH
ECX_TH proc
;ESI > Table
;ECX is index in table we want.
;find ecx_th entry in table
      and   ecx,ecx
jz @@X
dec ecx;is it first entry
jz @@X;is first then exit
@@:
lodsb
and al,al ;is byte equal zero
jnz @B;search for zero
dec ecx
jnz @B;find cx_th zero
@@X:
;ecx_th zero found exit
ret
ECX_TH endp
;
;Copy ESI byte to EDI byte until ESI byte = Zero
;
    align 8
    public copy_till_byte_Zero
copy_till_byte_Zero proc
    lodsb   ;esi = source
    and     al,al
    jz      @f
    stosb   ;edi = destination
    jmp     copy_till_byte_Zero
@@:         ;Zero Exit
    ret
copy_till_byte_Zero endp
    align 8
    public insert_az_cx
insert_az_cx    proc   
    mov     al," "
    stosb   
    movzx   eax,word ptr [ecx]
    push    ecx
    mov     ecx,eax
    add     ecx,delta
    call    ECX_TH
    pop     ecx
    call    copy_till_byte_Zero
    mov     al," "
    stosb 
    ret
insert_az_cx    endp
        align 8
        public LoadAndStore
LoadAndStore proc
        lodsb
        and al,al
        stosb
        jnz LoadAndStore
        xchg esi,edi;Swap back
        ret
LoadAndStore endp
.data
        align 8

        align 8
B_CX    dd 0;Bad lcid count
I_CX    dd 0;Index Count
T_CX    dd 0;Total Count = B_CX + I_CX       
delta   dd 0
BadLcid dd 0
stmUTC  SYSTEMTIME<>;
dfo       db " dddd,MMMM,dd,yyyy",0
tf        db "HH':'mm':'ss tt",0
          db 0
crlf      db  13,10,0
dtbufUTCb db " ";Space           
dtbufUTC  db 260 dup(0);London-UTC + 00
          dw 0 
          public Tgmt
Tgmt      db " GMT ",0
AppNameUTC db " LCID Language Date & Time ",0           
        align 8
; Last Edited Thursday, October 03, 2013 4:12:12 AM
; Source http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx
LCIDLang    equ $
        db  " Afrikaans ",  0
        db  " Albanian ", 0
        db  " Alsatian ", 0
        db  " Amharic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0
        db  " Arabic ", 0; Libya
        db  " Arabic ", 0; Morocco
        db  " Arabic ", 0; Oman
        db  " Arabic ", 0; Qatar
        db  " Arabic ", 0; Syria
        db  " Arabic ", 0; Tunisia
        db  " Arabic ", 0; United Arab Emirates
        db  " Arabic ", 0; Yemen
        db  " Armenian ", 0; Armenia
        db  " Assamese ", 0; Assam
        db  " Azeri (Cyrillic) ", 0 ; Azeri
        db  " Azeri (Latin) ", 0 ; Azeri
        db  " Bashkir ", 0 ; Bashkir
        db  " Basque ", 0
        db  " Belarusian ", 0
        db  " Bengali (India) ", 0
        db  " Bengali (Bangladesh) ", 0
        db  " Bosnian ", 0; (Herzego/Bosniavina)
        db  " Breton ", 0
        db  " Bulgarian ", 0
        db  " Burmese ", 0
        db  " Catalan ", 0
        db  " Cherokee ", 0
        db  " Chinese - People's Republic of China ", 0
        db  " Chinese - Singapore ", 0
        db  " Chinese - Taiwan ", 0
        db  " Chinese - Hong Kong ", 0
        db  " Chinese - Macao ", 0
        db  " Corsican ", 0; Spain?
        db  " Croatian ", 0; Yugoslovia?
        db  " Croatian B/H", 0; (Bosnia/Herzegovina)
        db  " Czech ", 0; Czechslovakia
        db  " Danish ", 0; Denmark
        db  " Dari ", 0 ; Asia? India/Afghanistan?
        db  " Divehi ", 0; ?
        db  " Dutch - Netherlands ", 0
        db  " Dutch - Belgium ", 0
        db  " Edo ", 0
        db  " English - USA ", 0
        db  " English - UK ", 0
        db  " English - Australia ", 0
        db  " English - Belize ", 0
        db  " English - Canada ", 0
        db  " English - Caribbean ", 0
        db  " English - Hong Kong ", 0
        db  " English - India ", 0
        db  " English - Indonesia ", 0
        db  " English - Ireland ", 0
        db  " English - Jamaica ", 0
        db  " English - Malaysia ", 0
        db  " English - New Zealand ", 0
        db  " English - Philippines ", 0
        db  " English - Singapore ", 0
        db  " English - South Africa ", 0
        db  " English - Trinidad ", 0
        db  " English - Zimbabwe ", 0
        db  " Estonian ", 0
        db  0 
LCountry equ $
        db  " South Africa ", 0
        db  " Albania ", 0
        db  " Alsatian ", 0
        db  " Ethiopia ", 0
        db  " Saudi Arabia ", 0
        db  " Algeria ", 0
        db  " Bahrain ", 0
        db  " Egypt ", 0
        db  " Iraq ", 0
        db  " Jordan ", 0
        db  " Kuwait ", 0
        db  " Lebanon ", 0
        db  " Libya ", 0
        db  " Morocco ", 0
        db  " Oman ", 0
        db  " Qatar ", 0
        db  " Syria ", 0
        db  " Tunisia ", 0
        db  " United Arab Emirates ", 0
        db  " Yemen ", 0
        db  " Armenia ", 0
        db  " Assam ", 0
        db  " Azeri ", 0; Cyrillic
        db  " Azeri ", 0; Latin
        db  " Bashkir ", 0; Bashkir
        db  " Spain ", 0; Basque
        db  " Belarusian ", 0
        db  " India ", 0; Bengali (India)
        db  " Bangladesh", 0; Bengali (Bangladesh)
        db  " Bosnia/Herzegovina ", 0
        db  " France ", 0; Breton
        db  " Bulguria ", 0
        db  " Burma ", 0
        db  " Spain ", 0
        db  " USA ", 0
        db  " China ", 0
        db  " Singapore ", 0
        db  " Taiwan ", 0
        db  " Hong kong ", 0
        db  " Macao ", 0
        db  " Spain - Corsican ", 0
        db  " Croatian ", 0
        db  " Bosnia/Herzegovina ", 0
        db  " Czechslovakia ", 0
        db  " Denmark ", 0
        db  " Dari ", 0
        db  " Divehi ", 0
        db  " Dutch ", 0
        db  " Dutch - Belgium ", 0
        db  " Edo ?? ", 0
        db  " United States of America ", 0
        db  " United Kingdom ", 0
        db  " Australia ", 0
        db  " Belize ", 0
        db  " Canada ", 0
        db  " Caribbean ", 0
        db  " Hong Kong (China) ", 0
        db  " India ", 0
        db  " Indonesia ", 0
        db  " Ireland ", 0
        db  " Jamaica ", 0
        db  " Malaysia ", 0
        db  " New Zealand ", 0
        db  " Philippines ", 0
        db  " Singapore ", 0
        db  " South Africa ", 0
        db  " Trinidad ", 0
        db  " Zimbabwe ", 0
        db  " Estonian ", 0 ; ??
        db  0       
LCIDcode    equ $
        dd  1078; South Africa - Decimal
        dd  1052; Albania
        dd  1156
        dd  1118
        dd  1025; Saudia Arabia
        dd  5121; Algeria
        dd  15361
        dd  3073; Egypt
        dd  2040; Iraq
        dd  11265; Jordan
        dd  13313; Kuwait
        dd  12289; Lebanon
        dd  4097; Libya 
        dd  6145; Morocco
        dd  8193; Oman
        dd  16385; Qatar
        dd  10241; Sryia
        dd  7169; Tunisa
        dd  14337; U.A.E.
        dd  9217; Yemen
        dd  1067; Armenia
        dd  1101; Assam
        dd  2092; Azeri Cyrillic
        dd  1068; Azeri Latin
        dd  1133; Bashkir
        dd  1069; Basque
        dd  1059; Belarusian
        dd  1093; Bengali (India)
        dd  2117; Bengali (Bangaladesh)
        dd  5146; (Bosnia/Herzegovina)
        dd  1150; Breton
        dd  1026; Bulguria
        dd  1109; Burma
        dd  1027; Spain
        dd  1116; USA
        dd  2052; China
        dd  4100; Singapore
        dd  1028; Taiwan
        dd  3076; Hong Kong
        dd  5124; Macao
        dd  1155; Corsican - Spain
        dd  1050; Croatian - Yugoslovia?
        dd  4122; Croatian - Bosnia/Herzegovina
        dd  1029; Czech
        dd  1030; Denmark - Danish
        dd  1164; Dari
        dd  1125; Divehi
        dd  1043; Netherlands
        dd  2067; Belgium
        dd  1126; Edo
        dd  1033; USA i e America
        dd  2057; United Kingdom i e UK i e England, Scotland, Wales
        dd  3081; Australia 
        dd  10249; Belize
        dd  4105; Canada
        dd  9225; Caribbean
        dd  15369; Hong Kong <China>
        dd  16393; India
        dd  14345; Indonesia
        dd  6153; Ireland
        dd  8201; Jamaica
        dd  17417; Malayasia
        dd  5129; New Zealand
        dd  13321; Philippines
        dd  18441; Singapore
        dd  7177; South Africa
        dd  11273; Trinidad
        dd  12297; Zimbabwe
        dd  1061; Estonian
        dd  1132;Sepedi
        dd  3098;Serbian (Cyrillic)
        dd  2074;Serbian (Latin)
        dd  1113;Sindhi-India
        dd  2137;Sindhi-Pakistan
        dd  1115;Sinhalese-Sri Lanka
        dd  1051;Slovak
        dd  1060;Slovenian
        dd  1143;Somali
        dd  1070;Sorbian
        dd  3082;Spain (Mod Sort)
        dd  1034;Spain (Trad Sort)
        dd  11274;Sp Argentina 
        dd  16394;Bolivia
        dd  13322;Chile
        dd  9226;Colimbia
        dd  5130;Costa Rica
        dd  7178;D R
        dd  12298;Ecuador
        dd  17418;El Salvador
        dd   4106;Guatemala
        dd  18442;Honduras
        dd   22538;Latin America
        dd  2058;Mex
        dd  19466;Nicaragua
        dd  6154;Panama
        dd  15370;Paraguay
        dd  10250;Peru
        dd  20490;Puerto Rico
        dd  21514;U S A
        dd  14346;Uruguay
        dd  8202;Venezuela
        dd  1072;Sutu
        dd  1089;Swahili
        dd  1053;Swedish
        dd  2077;Swe-Finland
        dd  1114;Syriac
        dd  1064;Tajik
        dd  1119;Tamazight (Arabic)
        dd  2143;Tamazight (Latin)
        dd  1097;Tamil
        dd  1092;Tatar
        dd  1098;Telugu
        dd  1054;Thai
        dd  2129;Bhutan-Tibetan
        dd  1105;PR China-Tibetan
        dd  2163;Tigrigna-Eritrea
        dd  1139;Tigrigna-Ethiopia
        dd  1073;Tsonga
        dd  1074;Tswana
        dd  1055;Turkisk
        dd  1090;Turkmen
        dd  1152;Uighur-China
        dd  1058;Ukr
        dd  1056;Urdu
        dd  2080;Urdu-India
        dd  2115;Uzbek Cyr
        dd  1091;Uzbek Latin
        dd  1075;Venda
        dd  1066;Viet
        dd  1106;Welsh
        dd  1168;Wolof
        dd  1076;Xhosa
        dd  1157;Yakut
        dd  1144;Yi
        dd  1085;Yiddish
        dd  1130;Yoruba
        dd  1077;Zulu
        dd  1279;Human Interface Device
        dd  0
        db  0
.code
        align 8
        public insertTime
insertTime proc ;GMT-UTC or London Time         
        INVOKE  GetTimeFormat,2057,TIME_FORCE24HOURFORMAT,addr stmUTC,addr tf,esi,32
        ;2057 UK to get AM/PM
        ret
insertTime endp
        align 8
        public CopyBuffTillZero
CopyBuffTillZero proc
        ;ESI > Ascii Zero Buffer
        ;Copy Till Zero Byte Found
        ;Carry set if ECX is Zero i e ECX = Count   
@@:
        lodsb
        and al,al
        jz @F
        stosb
        dec ecx
        jnz @B
        stc
@@:       
        ret
CopyBuffTillZero endp
      align 8   
good_code proc uses esi
      ;Enter Good Code Here
;
;NOTE do immediately after GetDateFormat-eax contains length of Format Text
; If GetDateFormat fails EAX will be Zero i e 0. Zero length Fields do
; Not have useful Imformation!!
      remzeroXbuf dtbufUTC
      call insertTime; London
      GetTimeZoneName Tgmt
      invoke StdOut,addr crlf
      print " LCID = "
      mov eax,BadLcid
      mov esi,ustr$(eax)
      invoke StdOut,esi;print Good LCID
      mov esi,offset LCIDLang
      mov ecx,I_CX
      call ECX_TH
      invoke StdOut,esi
      mov esi,offset LCountry
      mov ecx,I_CX
      call ECX_TH
      invoke StdOut,esi
      invoke StdOut,addr crlf
      invoke StdOut,addr dtbufUTC;
      ;inkey " << Wait Hands ... >> "
      invoke StdOut,addr crlf
      ret
good_code endp
start proc
      invoke GetSystemTime,addr stmUTC ;UTC+00   
      sub eax,eax
      mov I_CX,eax;Index
      mov T_CX,eax;Total
      mov B_CX,eax;Bad
      mov esi,offset LCIDcode
GetLCID::
      mov ecx,dword ptr [esi]
      and ecx,ecx
      mov BadLcid,ecx
      jz X_it
      mov eax,I_CX
      inc eax
      mov I_CX,eax
      mov T_CX,eax 
      push esi
      invoke GetDateFormat,ecx,0,addr stmUTC,addr dfo,addr dtbufUTC,sizeof dtbufUTC
      pop esi
      and eax,eax
      jnz LcidOK
      ;Failure Code Here
      mov eax,B_CX
      inc eax
      mov B_CX,eax
      push esi
      mov esi,offset LCIDLang
      mov ecx,I_CX
      call ECX_TH
      invoke StdOut,esi
      mov esi,offset LCountry
      mov ecx,I_CX
      call ECX_TH
      invoke StdOut,esi
      mov eax,BadLcid
      mov esi,ustr$(eax)
      invoke StdOut,esi;print Bad LCID
      inkey " << Wait Hands ... >> "
      pop esi
      jmp   lcidNext
      public LcidOK
LcidOK::
      call good_code
      public lcidNext
lcidNext::

      invoke GetSystemTime,addr stmUTC;UTC + 00
      add esi,4
      jmp GetLCID

ErTimLon::;
      pop esi;Balance Stack 
      print "<< Lomdon Time is Bad >>",13,10,7
X_it::
      mov esi,offset crlf
      invoke StdOut,esi
      print " Total LCID(s) is "
      mov eax,T_CX
      mov esi,ustr$(eax)
      invoke StdOut,esi
      print " Bad = "
      mov esi,ustr$(B_CX)
      invoke StdOut,esi
      inkey " << Wait Keyboard ... >> ",13,10,7
      exit
      ret         
start endp
      end start;D:\masm32\bin\lcidData.asm


Regards: Herge
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.