예제 #1
0
        private string StructToString(JRPCstruct JRPC)
        {
            byte[] buffer   = this.StructToByte(JRPC);
            string str      = "";
            string oldValue = "";

            for (int i = 0; i < buffer.Length; i++)
            {
                if (buffer[i] == 0)
                {
                    if (i >= (buffer.Length - 1))
                    {
                        oldValue = oldValue + "0;";
                    }
                    else
                    {
                        oldValue = oldValue + "0,";
                    }
                }
                else
                {
                    oldValue = "";
                }
                if (i >= (buffer.Length - 1))
                {
                    str = str + buffer[i] + ";";
                }
                else
                {
                    str = str + buffer[i] + ",";
                }
            }
            return(str.Replace(oldValue, "NULL;"));
        }
예제 #2
0
 private char[,] StringToChar(JRPCstruct J, int type, string String)
 {
     char[,] stringArg = J.stringArg;
     for (int i = 0; i < String.Length; i++)
     {
         stringArg[type, i] = String.ToCharArray()[i];
     }
     stringArg[type, String.Length] = '\0';
     return(stringArg);
 }
예제 #3
0
        private byte[] StructToByte(JRPCstruct str)
        {
            int cb = Marshal.SizeOf(str);

            byte[] destination = new byte[cb];
            IntPtr ptr         = Marshal.AllocHGlobal(cb);

            Marshal.StructureToPtr(str, ptr, false);
            Marshal.Copy(ptr, destination, 0, cb);
            Marshal.FreeHGlobal(ptr);
            return(destination);
        }
예제 #4
0
        public uint ResolveFunction(string ModuleName, uint Ordinal)
        {
            if (!this.activeConnection)
            {
                return(0);
            }
            JRPCstruct j = this.ResetStruct();

            j.Type       = this.SpawnEndian((uint)9);
            j.ArgType[0] = this.SpawnEndian(this.String);
            j.stringArg  = this.StringToChar(j, 0, ModuleName);
            j.ArgType[1] = this.SpawnEndian(this.Int);
            j.intArg[1]  = this.SpawnEndian(Ordinal);
            string commands = string.Concat(new object[] { @"A\0\T\9\A\2\", this.String.ToString(), "/", ModuleName.Length, @"\", this.StringToByteString(ModuleName), @"\", this.Int.ToString(), @"\", Ordinal.ToString(), @"\" });

            this.CallStruct(commands);
            return(uint.Parse(this.Recv(), NumberStyles.HexNumber));
        }