Visual Studio for application insider 2

Source: Internet
Author: User
Visual Studio for application insider 2

Of course, we will not compile and run every time. This is not our intention. Using the getcompiledstate of the ivsasite interface, we can mount the file in the compiled PE file and debugging information file.

Public sub getcompiledstate (byref PE () as byte, byref debuginfo () as byte) implements Microsoft. VSA. ivsasite. getcompiledstate

End sub

The implementation of this process has two parameters: the binary representation of the PE file and the debug information. To put it bluntly, the first file is the binary value of the DLL, the second file is the binary value of the PDB file.

How to obtain the compiled PE file and debugging information file

This process is mainly implemented using the savecomiledstate method of vsaengine. After compile is correct
If m_vsaengine.compile () then
M_vsaengine.run ()
End if
Dim PE () as byte
Dim PDB () as byte
M_vsaengine.savecompiledstate (PE, PDB)

Next, it's about writing binary files.

Dim FS as new filestream ("C: \ test. dll", filemode. Create)
Dim BS as new binarywriter (FS)
BS. Write (PE)
FS. Close ()
BS. Close ()
FS = new filestream ("C: \ test. PDB", filemode. Create)
BS = new binarywriter (FS)
BS. Write (PDB)
FS. Close ()
BS. Close ()

 

Next, we switch to the class implementing ivsasite. In this example, myvsasite is used. We implement the getcompiledstate method.

 

Public sub getcompiledstate (byref PE () as byte, byref debuginfo () as byte) implements Microsoft. VSA. ivsasite. getcompiledstate
Dim FS as filestream = new filestream ("C: \ test. dll", filemode. open)
Dim BS as binaryreader = new binaryreader (FS)
Pe = BS. readbytes (FS. length)
FS. Close ()
BS. Close ()
FS = new filestream ("C: \ test. PDB", filemode. open)
BS = new binaryreader (FS)
Debuginfo = BS. readbytes (FS. length)

End sub

When you call the run method of vsaloader, vsaloader calls the getcompiledstate method of its site object to obtain data.

This is an example of a call.
 

M_vsaengine = new Microsoft. VSA. vsaloader
M_vsaengine.rootnamespace = "test"
M_vsaengine.rootmoniker = "test: // project1"

M_vsaengine.site = new myvsasite
M_vsaengine.run ()

Dim ARGs () as object = new object () {"jjx "}

Invoke ("testclass. Hello", argS)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.