| Author |
Message |
alehandro
Joined: 16 Nov 2010 Posts: 35
|
Posted: Thu Feb 03, 2011 11:00 pm Post subject: Private method access - wrong |
|
|
Hi,
I've seen in some assemblies the following issue:
when a class implements some interface, the implemented methods cant be private, dont know if its up to protector or smth else. Is it possbile to add analysis in Refl to make these methods public?
example
source module with issues
=================
using System;
using System.Runtime.InteropServices;
public class c000806 : afv, IDisposable
{
private int f000002;
private int f00002f;
private IntPtr f000058;
public c000806(int A_0)
{
this.f000058 = Marshal.AllocCoTaskMem(A_0);
this.f000002 = A_0;
}
public void Dispose()
{
if (this.f000058 != IntPtr.Zero)
{
Marshal.FreeCoTaskMem(this.f000058);
this.f000058 = IntPtr.Zero;
GC.SuppressFinalize(this);
}
}
~c000806()
{
this.Dispose();
}
public int m00000c()
{
return this.f00002f;
}
private int m000025(int A_0)
{
if (A_0 > this.f000002)
{
return -2147483645;
}
this.f00002f = A_0;
return 0;
}
private int m000025(out int A_0)
{
A_0 = this.f000002;
return 0;
}
public void m00003f(int A_0)
{
if (this.f00002f > this.f000002)
{
throw new ArgumentException("Cannot be greater than maximum buffer size");
}
this.f00002f = A_0;
}
private int m00055e(IntPtr A_0, IntPtr A_1)
{
if (A_0 != IntPtr.Zero)
{
Marshal.WriteIntPtr(A_0, this.f000058);
}
if (A_1 != IntPtr.Zero)
{
Marshal.WriteInt32(A_1, this.f00002f);
}
return 0;
}
public void m0009b5(byte[] A_0, int A_1)
{
this.m00003f(A_1);
Marshal.Copy(A_0, 0, this.f000058, A_1);
}
public void m000d5c(byte[] A_0, int A_1)
{
Marshal.Copy(this.f000058, A_0, A_1, this.m00000c());
}
}
interface
================
using System;
using System.Runtime.InteropServices;
using System.Security;
[ComImport, Guid("59eff8b9-938c-4a26-82f2-95cb84cdc837"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), SuppressUnmanagedCodeSecurity]
public interface afv
{
[PreserveSig]
int m000025(int A_0);
[PreserveSig]
int m000025(out int A_0);
[PreserveSig]
int m00055e(IntPtr A_0, IntPtr A_1);
}
issues
================
Error 3 'c000806' does not implement interface member 'afv.m000025(int)'. 'c000806.m000025(int)' cannot implement an interface member because it is not public.
Error 2 'c000806' does not implement interface member 'afv.m000025(out int)'. 'c000806.m000025(out int)' cannot implement an interface member because it is not public.
Error 1 'c000806' does not implement interface member 'afv.m00055e(System.IntPtr, System.IntPtr)'. 'c000806.m00055e(System.IntPtr, System.IntPtr)' cannot implement an interface member because it is not public. \NS371857150\c000806.cs 4 14
Last edited by alehandro on Tue Feb 15, 2011 9:16 pm; edited 1 time in total |
|
| Back to top |
|
 |
alehandro
Joined: 16 Nov 2010 Posts: 35
|
Posted: Thu Feb 03, 2011 11:03 pm Post subject: |
|
|
another sample:
public class c00086a : IDisposable
{
....
private void Dispose() << private!!!??
{
try
....
}
}
Error 54 'c00086a' does not implement interface member 'System.IDisposable.Dispose()'. 'c00086a.Dispose()' cannot implement an interface member because it is not public.
Last edited by alehandro on Tue Feb 15, 2011 9:15 pm; edited 1 time in total |
|
| Back to top |
|
 |
Clive Tong
Joined: 04 Dec 2008 Posts: 281
|
Posted: Thu Feb 10, 2011 12:09 pm Post subject: |
|
|
| I've logged that as RP-1028. |
|
| Back to top |
|
 |
screenpresso
Joined: 15 Feb 2011 Posts: 1
|
Posted: Tue Feb 15, 2011 5:53 pm Post subject: Licensing |
|
|
Hi,
I am from Screenpresso software development team and I would be pleased to know why you, alehandro, are trying to disable our software which is something illegal.
If you have any questions, fell free to contact us.
Regards,
Screenpresso team |
|
| Back to top |
|
 |
alehandro
Joined: 16 Nov 2010 Posts: 35
|
Posted: Tue Feb 15, 2011 9:07 pm Post subject: |
|
|
Hi,
I'm glad you are reading my poor posts
Well, of course I"m not trying to disable any SW, my only aim was to make the tool more correct in some specific cases.
As you see that case was to correct public/private visibility of members.
My apoligies if I offend you. |
|
| Back to top |
|
 |
|