Jump to content
Sign in to follow this  
b1naryc0de

Visual Studio.net

Recommended Posts

kalo nak download kat internet yang full punye, tak dapat la jack. cube carik kat kedai cd..

Share this post


Link to post
Share on other sites

ye.. aku silap guna ayat. sori. aku suka sebut .net nyer program sebagai binary. aku tak tau plak compiler selain dari M$ nyer C++ compiler yg bleh hasilkan mix code (msil+x86).. tapi tu kod dalam C (plus inline asm).. aku nak assembler yg bleh compile il+x86.. ni kena buat sendiri gak ni.. hehe..

lagi satu.. since dalam NT ader kod yg bleh dilaksanakan sebelum entrypoint program (feature of thread local storage, called tls callback).. what happen kalau aku ade tls callback ni dalam .net nyer program? setau aku takde compiler yg support tls callback nih. tapi aku nak tau gak aper jadi.

Share this post


Link to post
Share on other sites

hohoho.. susah gak tu. sebab kod il akan di launch on VES (il -> VES). dan salah satu yang bagusnye VES (virtual exec) ni adalah untuk tukar dari il ke proc instructor yang berlainan (VES -> proc - eg. x86, sparc). dalam VES ni plak depand pakai proc ape untuk tukar dari IL ke instruction proc tertentu (sebab tu kalo nak donlod mono kene pilih OS + proc yang seswai).

berbanding dengan C yang ade inline asm tu akan terus dikompil ke native language (memang dah di spec kan ke proc ape).

tapi memang tak mustahil kalo dapat buat macam tu (IL + x86). tapi kene la power x86 punye instruction and maybe mostly dalam x86 (?) ko buat la. seronok gak bunyiknye (aku lemah x86 nie.. hehehe:)

tls callback? wah haha. boleh launch sebelum entry point ke? die call kat pe ke?

abbr: proc = processor, VES = virtual execution sistem.

ps: BSBJ tu tak tau lagi ar. ko dah tau ke?

Share this post


Link to post
Share on other sites

ader orang bagitau BSJB wakil nama 4 core developers untuk CLR.. tak tau laa nama sebenarnya saper. nanti aku tanya lagi. tapi saper peduli.. hehe.. aku just nak tau jer.

Kalau setakat nak call native code through dll exports takde masalah laa.. just guna pinvokeimpl tapi yg aku nak buat ni yg sekali dalam module (tah aper dia panggil.. ijw thunk ke aper tah). ari tu aku try nak implement ilasm just melalui fasm's macros.. tapi memandangkan kompleks sangat nak build metadata table.. abaikan jer laa..

aku tak sure laa pasal tls callback tuh sebab kalau dia support, kita bleh ader native thread yg run serentak ngan managed code (create new thread dalam tls callback then exit).. cam pelik jer.. macam2 bleh buat tu (just imaginasi aku laa).

Share this post


Link to post
Share on other sites

hehe.. tak salah berimaginasi tinggi.

aku dah setup mono kat suse aku, tapi still tak leh run .net (gune wine - import_dll missing tah pebende tah). nanti aku nak test install .net gune wine plak. hehe..

tapi ancient one, aku rase kite dah off topik jauh ni. dah macam takde kene mengene dengan visual studio.net, tapi lebih ke fundamental .net..

Share this post


Link to post
Share on other sites

lantak laa... admin diam2 jer.. kita pun diam2 je la... hehe..

seronok gak main ngan .net nih. Aku dah download Mono ngan dotGnu, dan of couse .NET Framework 2.0... aku try build sebijik .NET program by hand sajer nak test native code. ader kat sini (compile guna fasm). Tapi Mono ngan dotGnu tak support lagi native code ek.. Kalau dalam ilasm takleh nak tulis laa kod ni sebab dia takleh compile native unmanaged method. Tapi kalau nak jugak secara kasar camni laa kot :

.assembly extern mscorlib {}
.assembly Test {}

.vtfixup [1] at test_vt

.method public static pinvokeimpl() void nativeTestFunc(int32 i) native unmanaged {
    /*kat sini native code.. camni laa rupanya
    mov     eax, [esp+4]
    mov     eax, [esp+4]
    push    eax formatter
    call    [printf]
    add     esp, 4*2
    call    [getch]
    cmp     al, 's'
    je      done
    call    dword [test_vt]
    done:
    ret     4
formatter db "[Unmanaged] Nilai dari Entrypoint = %i", 0
    */
}

.method public static void Entrypoint() cil managed {
  .entrypoint
  .vtentry 1:1
  ldstr     "Jumlah (100+50)*20-1 ialah "
  call      void [mscorlib]System.Console::Write(string)
  ldc.i4.s  100
  ldc.i4.s  50
  add
  ldc.i4.s  20
  mul
  ldc.i4.1
  sub
  dup
  call      void [mscorlib]System.Console::Write(int32)
  ldstr     "\n"
  call      void [mscorlib]System.Console::Write(string)
  call      void nativeTestFunc(int32)
  ret
}

.data test_vt = int32(0)

v-table fixup tu perlu sebab aku nak call Entrypoint semula dari nativeTestFunc (so program ni akan loop selamanya, unless.. see native code). aku pon tak pasti camtu ke bentuknya? kalau ikut grammar ye kot.. hehe..

Share this post


Link to post
Share on other sites

wow. best. tapi kenape tak leh nak download?

HTTP1.1 STATUS 403 Remote Access to this object forbidden This file cannot be directly accessed from a remote site, but must be linked through the Brinkster Member's site.

assemble gune fasm? so, ko kene import mscorlib skali la ye? atau pakai ilasm je dah boleh buat?

Edited by F A

Share this post


Link to post
Share on other sites

alo ancient one, aku rase aku dah tau ape yang dimaksudkan bsjb tu.. ni aku petik dari benny (ni sebenarnye tutorial pasal virus, but i'll skip that part)

It seemz that the first byte(z) (402050h) are some method/module specific

recordz and then follows meta-dataz. I figured out that meta-data recordz

are stored alwayz below the meta-code. 424A5342h ("BSJB") seemz to be magic

number of the metadata directory and then follows some flagz and internal

recordz (namez and tokenz of class itemz - methodz, atributtez, propertiez

etc...).

I hope that somewhere on the net will appear some documentation of MSIL/CLR

internal formatz which will give us a better look at this thing.

lagi satu, bsjb ni hanya masa kat .net beta 2 (januari 2002 kot). so sekarang dah tak pakai signature bsjb nie.. :)

Share this post


Link to post
Share on other sites

i know "BSJB" is some kind of magic number... yg aku nak tau aper makna setiap huruf tuh??? Errr.. maner bleh suka ati tukar signature nih.. signature tuh penting untuk backward compatibility.. kalau version string yang tukar takpe laa kot.. agaknya ko dah salah info nih.

kalau takleh download direct, cuba copy link tu dan letak kat url address bar kat ie ker ape. hampeh nyer brinkster.

actually tu cuma sample program .net yang aku bina secara manual.. compile guna fasm. tak perlu ilasm atau menatang lain. aku ingat nak buat ilasm versi aku sendiri hanya dengan fasm macros.. tengoklah camne nanti..

Share this post


Link to post
Share on other sites

aku pon dah mati akal pasal bsjb nie. but it is really possible to write a .net assemblies using native language. cume pening sikit nak paham. invoke tu leh la paham sikit sebab interaction dari managed data -> unmanaged (dynamic). tapi kalo direct use intermediate language dalam low level language, tu yang wat tak paham.. sebab kalo dah compile leh jadi execute dalam VES? aku rase sebab tu la (sebab VES) tak leh kot ko buat untuk mono...

ko dah wat ke macro dalam fasm tu? aku skrg baru cuba nak jinak2 dengan fasm (tak jinak sangat ar).. :lol:

Share this post


Link to post
Share on other sites

kiter bleh bina assembly ngan native code, i mean create methods ngan native asm, bukan il asm. only visual c++ (yg aku aware laa) yang bleh lakukan ni.. agaknya ni laa .net compiler paling power ye tak.. actually Mono bleh support native unmanaged method kalau dia nak.. cuma belum lagi laa kot.. aku dah buat brape experiment ngan fasm tapi nampak gayanya kalau nak support sintaks cam kat dalam spec (ilasm) takleh laa kot.. aku cuma nak memudahkan creations of metadata tables using syntax aku sendiri... so bleh laaa aku experiment banyak2 ngan .net nih.. hehehe..

ari tu aku guna ilasm's ".emitbyte" directive untuk generate native code, e. g

public static void F() native unmanaged {
 .emitbyte 0xC3
}

camtu laa konon2nya.. but since benda ni ader "header" kat awal, bila aku call dari managed method dapatlaa exception sebab dia execute "header" tu dulu.. guna pointer manipulation (e.g ldftn, add) pun tak berjaya gak.. susah tul takde debugger nih..

Edited by Ancient One

Share this post


Link to post
Share on other sites

@ancient one:

aku buat thread baru.. nanti aku bagitau mod utk gabungkan thread kat sini.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...