0
I Use This!
Activity Not Available

Project Summary

#define WIN32_LEAN_AND_MEAN

#include #include #include #include #include #include "winmain.h"

int main (char szArgs, int argc) {

char szFileMAX_PATH;

// Copyright //
textbackground (0);
textcolor (7);
printf ("MSN Messenger 7.0 Version Patch\r\n");
printf ("Makes MSN Messenger 7.5 work without updating to crappy WLM.\r\n");
printf ("(C) 2007 - tester001\r\n");
// Do the job //
if (GetMSNFile (szFile, sizeof (szFile)))
PatchFile (szFile);
else {
textcolor (14);
printf ("\r\nPatch canceled.\r\n");
}
textcolor (15);
system ("pause");
return FALSE;
}

BOOL GetMSNFile (char szBuffer, int iSize) {

OPENFILENAME stOpen;
HKEY hRegKey;
int iOutSize;

// Get the probable MSN Messenger location //
textcolor (15);
printf ("\r\nLooking for MSN Messenger installation...\r\n");
memset (szBuffer, 0, iSize);
iOutSize = iSize;
if (RegOpenKey (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\MSNMessenger",
&hRegKey) == ERROR_SUCCESS) {
if (RegQueryValueEx (hRegKey, "InstallationDirectory", NULL, NULL,
szBuffer, &iOutSize) == ERROR_SUCCESS) {

strcat (szBuffer, "msnmsgr.exe");

textcolor (11);
printf ("MSN Messenger installation found at\r\n%s\r\n"
"Use this file? (Press N to look for it)", szBuffer);
if (confirm ())
return TRUE;
}
}
if (! szBuffer0) {
textcolor (14);
printf ("MSN Messenger installation not found.\r\n"
"Would you like to look for it?", szBuffer);
if (! confirm ())
return FALSE;
}
// Show the open file dialog //
memset (&stOpen, 0, sizeof (OPENFILENAME));
stOpen.lStructSize = sizeof (OPENFILENAME);
stOpen.lpstrFilter = "msnmsgr.exe\0.exe\0\0";
stOpen.lpstrTitle = "Open MSN Messenger 7.5";
stOpen.lpstrFile = szBuffer;
stOpen.nMaxFile = iSize;
stOpen.Flags = OFN_OVERWRITEPROMPT|OFN_ENABLESIZING|OFN_HIDEREADONLY;
if (! GetOpenFileName (&stOpen))
return FALSE;
return TRUE;
}

BOOL PatchFile (char szFile) {

char szBkpFileMAX_PATH;
int iBkpIndex;
FILE pFile;
fpos_t stSize;
long iSize;
void pBuf;
char pNow;
int i;

// Backup the file //
textcolor (15);
printf ("\r\nCreating a backup file...\r\n");
sprintf (szBkpFile, "%s.bkp", szFile);
iBkpIndex = 0;
while (! CopyFile (szFile, szBkpFile, TRUE)) {
if (iBkpIndex >= 999) {
textcolor (12);
printf ("\r\nCould not create a backup file.\r\n");
goto patch_failed;
}
sprintf (szBkpFile, "%s.bkp%003d", szFile, ++iBkpIndex);
}
textcolor (11);
printf ("%s => %s\r\n", strrchr (szFile, '\\'), strrchr (szBkpFile, '\\'));
// Open the file //
textcolor (15);
printf ("\r\nOpening file...\r\n");
pFile = fopen (szFile, "rb+");
if (! pFile) {
OutputLastError ();
goto patch_failed;
}
// Allocate enough memory and read the file contents //
textcolor (15);
printf ("\r\nBuffering file contents...\r\n");
fseek (pFile, 0, SEEK_END);
fgetpos (pFile, &stSize);
fseek (pFile, 0, SEEK_SET);
iSize = stSize.off;
pBuf = malloc (iSize);
if (! pBuf) {
OutputLastError ();
fclose (pFile);
goto patch_failed;
}
fread (pBuf, 1, iSize, pFile);
if (ferror (pFile)) {
OutputLastError ();
fclose (pFile);
goto patch_failed;
}
// Replace the version occurrences //
textcolor (15);
printf ("\r\nPatching file buffer...\r\n");
pNow = (char ) pBuf;
for (i=0; i < (iSize - 3); i++) {
pNow = ((char ) pBuf) + i;
if ((pNow0 == '7') &&
(pNow1 == '\0') &&
(pNow2 == '.') &&
(pNow3 == '\0') &&
(pNow4 == '5') &&
(pNow5 == '\0') &&
(pNow6 == '.') &&
(pNow7 == '\0')) {
textcolor (11);
printf ("%008X %c.%c.%c%c%c%c => 9.9.9999\r\n", pNow,
pNow0, pNow4, pNow8, pNow10, pNow12, pNow14);
pNow0 = '9';
pNow4 = '9';
pNow8 = '9';
pNow10 = '9';
pNow12 = '9';
pNow14 = '9';
}
}
// Flush the buffer to the file //
textcolor (15);
printf ("\r\nUpdating file contents from buffer...\r\n");
fseek (pFile, 0, SEEK_SET);
fwrite (pBuf, 1, iSize, pFile);
fflush (pFile);
fclose (pFile);
// Patch succesful //
textcolor (10);
printf ("\r\nPatch succesful!\r\n\r\n");
return TRUE;
// Patch failed //
patch_failed:
textcolor (12);
printf ("\r\nPatch failed.\r\n\r\n");
return FALSE;
}

DWORD OutputLastError (void) {

char szMessage512;
DWORD iErrorCode;

// Get the last message code //
iErrorCode = GetLastError ();
// Show the system error text //
if ( FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, iErrorCode, 0,
szMessage, sizeof (szMessage), NULL)); {
textcolor (12);
printf ("%s\r\n", szMessage);
}
return iErrorCode;
}

BOOL confirm (void) {

char chOpt;

textcolor (15);
printf (" (Y/N) ");
for (;;) {
chOpt = toupper ((char) getchar ());
switch (chOpt) {
case 'Y':
return TRUE;
case 'N':
return FALSE;
default:
continue;
}
}
}

Tags

No tags have been added

In a Nutshell, kosovas-...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Mozilla Public License 1.1
Permitted

Commercial Use

Modify

Distribute

Place Warranty

Use Patent Claims

Forbidden

Sub-License

Hold Liable

Required

Distribute Original

Disclose Source

Include Copyright

State Changes

Include License

Include Install Instructions

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    compare projects before you chose one to use
  • ...
    use of OSS increased in 65% of companies in 2016
  • ...
    anyone with an Open Hub account can update a project's tags

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis