Quantcast

Jump to content

» «
Photo

Creating a dll for VC

9 replies to this topic
Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#1

Posted 09 May 2012 - 01:27 PM Edited by Ashwin the new boy, 09 May 2012 - 01:29 PM.

Hi Friends,
as the topic says,
i need your help in making a Working DLL for Vice city.

::DLL::
which write some value to a memory address

example >>>>
writing 1 byte value 245 to 0xA10B81
writing a string 'blabla' to 0x68F1F4
& writing a float value 99999.99 to 0x69C780

I want to do this by using 'Code blocks'

please tell me the code that i should write in CB for this
or a Link to your uploaded Project will be great

Actually i know what to write lol.gif but the DLL is not working,
Waiting ... monocle.gif

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#2

Posted 09 May 2012 - 01:34 PM

If it will be loaded into gta_vc.exe, possibly ASI plugin.

C++
CODE
*(char*)0xA10B81 = 245;

strcpy((char*)0x68F1F4, "blabla");

*(float*)0x68F1F4 = 99999.99;

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#3

Posted 09 May 2012 - 01:44 PM Edited by Ashwin the new boy, 09 May 2012 - 01:48 PM.

i was using
CODE

*(float*)0x68E704 = 1.0f;
  *(byte*)0x4A6B7C = 113;

but doesn't work, i am using C++ after a looong gap.
May be possible i forgot something (also using CODE BLOCK First time lol.gif )
----------------------
i want the full code from TOP to END
i mean from "#include" to "return TRUE;}"
sorry for behaving like a Big NOOB here

also > found a prob. that i was building it in Debug mode blush.gif
is it necessary to do that all .res & .def thing ?

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci
  • Joined: 20 Jun 2010
  • Netherlands

#4

Posted 09 May 2012 - 01:45 PM

Take a look at the source code of s0beit: link

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#5

Posted 09 May 2012 - 01:57 PM

Yes, you forgot

CODE
void UnprotectMemory(LPVOID address, size_t size)
{
DWORD dwProtect;
VirtualProtect(address,size,PAGE_EXECUTE_READWRITE, &dwProtect);
}


Use this function before writing values if memory on certain address is protected.
Usage:
CODE

UnprotectMemory((void*)0x68E704, sizeof(float));


No need if specified memory area is not protected

Remember to do
CODE
#include "windows.h"

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#6

Posted 09 May 2012 - 02:51 PM Edited by Ashwin the new boy, 10 May 2012 - 09:01 AM.

I am trying ....
tell you the result soon

I am not using Virtual protected Mem add BTW.

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#7

Posted 09 May 2012 - 04:14 PM

You can take a look at the source of
http://www.gtagarage...ow.php?id=17919
from fastman92.
---

And
I did this some times ago, but didn't finished (I just started and stopped, maybe later I continue), since I just started the code is very simple (and bugged, but it writes in the address very well)

Here is it: http://pastebin.com/Anbvviei

It has a replica of the CLEO Opcode Write Memory, for string:
CODE
void WriteMemory(void* Address, int size, char* value, bool vp = false)
{
DWORD oldProtect;
if(vp)
 VirtualProtect(Address, size, PAGE_EXECUTE_READWRITE, &oldProtect);

strncpy(Address, value, size);

if(vp)
 VirtualProtect(Address, size, oldProtect, &oldProtect);
}

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#8

Posted 10 May 2012 - 03:25 AM

Is that all i have to write in dll code to make a DLL which increase the MAX hight limit to 99999.99
CODE

#include <Windows.h>


BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
   switch (fdwReason)
   {
       case DLL_PROCESS_ATTACH:
       *(float*)0x68F1F4 = 99999.99;   //mem add is not VP
           // attach to process
           // return FALSE to fail DLL load
           break;

       case DLL_PROCESS_DETACH:
           // detach from process
           break;

       case DLL_THREAD_ATTACH:
           // attach to thread
           break;

       case DLL_THREAD_DETACH:
           // detach from thread
           break;
   }
   return TRUE; // succesful
}

after building, i get a DLL(5.50 KB) in release folder,
i put it in mss folder after renaming it to .flt
//NO EFFECT//
----------------------------
i am sure i have make some silly Mistake ...

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#9

Posted 15 May 2012 - 12:47 PM

I tried a lot but There is NO effect on those mem addresses
Can anyone make & upload a DLL Project
so that i can also start DLL coding
please ...

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#10

Posted 15 May 2012 - 01:16 PM

QUOTE (Ashwin the new boy @ Tuesday, May 15 2012, 12:47)
I tried a lot but There is NO effect on those mem addresses
Can anyone make & upload a DLL Project
so that i can also start DLL coding
please ...

QUOTE
You can take a look at the source of
http://www.gtagarage...ow.php?id=17919
from fastman92.
---




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users