472,989 Members | 2,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

Correct way to use Assembly.Load(byte())?

I'm struggling with an odd problem and I want to validate something.

What is the right way to load an assembly from bytes?

Is this code correct? :

....
Private Function loadBytes(filename as string) as Byte()
Dim fs As New FileStream(filename, FileMode.Open)
Dim buffer(CInt(fs.Length)) As Byte
fs.Read(buffer, 0, buffer.Length)
fs.Close()
return buffer
End Function

Dim rawAssembly() as Byte = loadBytes("aWellFormatedPath&FileName")

[Assembly].Load(rawAssembly)
....

Nov 19 '05 #1
1 1750
sure. but because you are loading an assembly from memory, if that assembly
references another assembly, you should load that one first (as you have a
rather restricted search path).

-- bruce (sqlwork.com)
"mathlec" <ma*****@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
I'm struggling with an odd problem and I want to validate something.

What is the right way to load an assembly from bytes?

Is this code correct? :

...
Private Function loadBytes(filename as string) as Byte()
Dim fs As New FileStream(filename, FileMode.Open)
Dim buffer(CInt(fs.Length)) As Byte
fs.Read(buffer, 0, buffer.Length)
fs.Close()
return buffer
End Function

Dim rawAssembly() as Byte = loadBytes("aWellFormatedPath&FileName")

[Assembly].Load(rawAssembly)
...

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Russell Stevens | last post by:
Should be trivial - I want to detect the program version so that I can take steps to update things to the current version. Pretty simple - just use Application.ProductVersion So I install the...
4
by: Arnaud Debaene | last post by:
Hello group. I have an app which can load "plugins" assemblies that are described in the registry (each registry entry gives the full path to the plugin ..dll file). The plugins may be anywhere...
1
by: Abdessamad Belangour | last post by:
Hi all, An assembly is composed of a set of modules. An Assembly and a Module classes have a GetTypes() methods. Moreover, an Assembly class has a GetExportedTypes() method. 1. This means that if...
7
by: Oldman | last post by:
How do you conditionally reference an assembly based off of the build configuration? Imagine a scenario where I want to have an Sql Release Server build and an Oracle Release Build and the only...
2
by: Tim Bücker | last post by:
Hello. How can I inform the user that he is not using the correct assembly? Something like: "You have version 1.1 installed but you need version 1.2! Good Bye" Is the question too stupid -...
12
by: TC | last post by:
I'm trying to figure out what the "Friend" keyword does. I know it specifies that "elements are accessible from within the same assembly", but that doesn't help because I don't know what an...
0
by: Achim Domma | last post by:
Hi, I try to develop a localized Asp.Net 1.1 application. I have added two resource files to my app, which are called 'Labels.resx' and 'Labels.de.resx'. If I compile the app, I see a 'de'...
0
by: dodger_web | last post by:
hi, i need to load a config file from my code. this config file is supposed to be in the same directory of the assembly (a dll). i've tried many ways like this one, but when i run nunit...
0
by: savajx1 | last post by:
I am loading signed assemblies from a network share. The assemblies are NOT INSTALLED in the GAC as they are part of an enterprise distributed application implemented as a windows service that...
2
by: Beemer Biker | last post by:
I have some demo code that came with a 3rd party product. This is what it looks like (I remove html braces in case it does not print right) Register TagPrefix="pin"...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.