473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

.NET Reversing

115 100+
Im using .NET reflector to extract a call I need to use in an unmanaged environment. I came accross function declared as "internal static extern" with the attribute "[MethodImpl(MethodImplOptions.InternalCall)]" How do I find the actual implementation of that call?
Nov 26 '08 #1
2 2816
anijos
52
1. Download the Shared Source Common Language Infrastructure at the following link:

Download details: Shared Source Common Language Infrastructure 2.0 Release

2. Search ecall.cpp in the sscli20\clr\src\vm directory of the tgz file you just downloaded for "InternalGetHashCode". You'll find something like this:


Expand|Select|Wrap|Line Numbers
  1. FCFuncElement("InternalGetHashCode", ObjectNative::GetHashCode)   


This means that "InternalGetHashCode" calls the GetHashCode method of the ObjectNative object. Now you have to find that method in the files you just downloaded.

3. Start looking through some of the other files. There are alot. I found this method under the file "comobject.cpp":


Expand|Select|Wrap|Line Numbers
  1. // Note that we obtain a sync block index without actually building a sync block.   
  2. // That's because a lot of objects are hashed, without requiring support for   
  3. FCIMPL1(INT32, ObjectNative::GetHashCode, Object* obj) {   
  4.  
  5.     CONTRACTL   
  6.     {   
  7.         THROWS;   
  8.         DISABLED(GC_NOTRIGGER);   
  9.         INJECT_FAULT(FCThrow(kOutOfMemoryException););   
  10.         MODE_COOPERATIVE;   
  11.         SO_TOLERANT;   
  12.     }   
  13.     CONTRACTL_END;   
  14.  
  15.     VALIDATEOBJECTREF(obj);   
  16.  
  17.     DWORD idx = 0;   
  18.  
  19.     if (obj == 0)   
  20.         return 0;   
  21.  
  22.     OBJECTREF objRef(obj);   
  23.  
  24.     HELPER_METHOD_FRAME_BEGIN_RET_1(objRef);        // Set up a frame   
  25.  
  26.  
  27.     idx = GetHashCodeEx(OBJECTREFToObject(objRef));   
  28.  
  29.  
  30.     HELPER_METHOD_FRAME_END();   
  31.  
  32.     return idx;   
  33. }   
  34. FCIMPLEND  
There's your implementation!


A better explantion on how and why this works can be found here (Last Question of the article)
Nov 27 '08 #2
ShadowLocke
115 100+
Thanks anijos. But looking through this i didnt find the particular function i was looking for "InternalReleaseComObject". After looking through the files you mentioned I did a search for ReleaseCom in every file with no luck. Any ideas?
Nov 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Aki Niimura | last post by:
Hello everyone, I need to reverse an iterator in my program. There are many posting to related to this. But most of them are talking about how to expand the language to support such. In fact...
4
by: Kevin | last post by:
Hello, I need to some help in reversing an 2-dimensional array. I am working with gif images and I am trying to make the mirror image. I was hoping that someone could help give me a headstart...
11
by: Tim Marshall | last post by:
I use Terry Kreft's & Stephen Lebans colour dialog procedures for users to pick colours for various control properties in certain apps. Is there a way to take the colour code that is displayed in...
45
by: Ajay | last post by:
Hi all,can you please tell the most efficient method to reverse a byte.Function should return a byte that is reversed.
3
by: dru | last post by:
Problem: Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the second with the next to the last, and so on, all the way to the...
4
by: hello12 | last post by:
Hello, I am new to java and i was having a hard time figuring out on how to do certain string manipulations. I was asked to read in a text file and reverse the words. So far, I have put all...
8
by: arnuld | last post by:
i have created a solutions myself. it compiles without any trouble and runs but it prints some strange characters. i am not able to find where is the trouble. ...
16
by: Scott | last post by:
Yeah I know strings == immutable, but question 1 in section 7.14 of "How to think like a computer Scientist" has me trying to reverse one. I've come up with two things, one works almost like it...
7
by: benn686 | last post by:
Anyone know of an efficient way of reversing the bits of a word??
1
by: rajkumarbathula | last post by:
Hi Could any one help me out in reversing rows/elements of DataTable or String or DataList by using any simple statement? Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.