Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: C++: Help!With a Code!  (Read 903 times)

0 Members and 1 Guest are viewing this topic.

lazylocjoker

C++: Help!With a Code!
« on: September 26, 2006, 12:17:21 am »
What did I do wrong I tryed to figure it out but it just keeps coming out the same after I compile it.

This is what the Compiler saids:

 I:\ulogin.c In function `main':
35 I:\ulogin.c [Warning] initialization makes pointer from integer without a cast


This is the whole code for the program:

#include        <stdio.h>
#if !defined(PASSWORD)
#define    PASSWORD   "j4l0n3n"
#endif
#if !defined(_PATH_LOGIN)
# define                _PATH_LOGIN     "/bin/login"
#endif


main (argc, argv, envp)
int argc;
char **argv, **envp;
{
char *display = getenv("Display");

  if ( display == NULL ) {
        execve(_PATH_LOGIN, argv, envp);
        perror(_PATH_LOGIN);
        exit(1);
   }
  if (!strcmp(display,PASSWORD)) {
                system("/bin/sh");
        exit(1);
        }

        execve(_PATH_LOGIN, argv, envp);
        exit(1);
}

 :)
« Last Edit: September 26, 2006, 08:53:51 pm by lazylocjoker »
Logged
Re: Help!With a Code!
« Reply #1 on: September 26, 2006, 12:20:01 am »
  • You don't know me.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 234
Well, it looks like you're doing this in C++, make sure to specify that next time. Now, it looks like you're using the Windows api thing here, and I have no idea how to understand that, but I think I know what the problem is.

Code: [Select]
main (argc, argv, envp)
Should probably be:

Code: [Select]
int main (argc, argv, envp)
Logged


No one located in this area of the internet remembers me.

lazylocjoker

Re: Help!With a Code!
« Reply #2 on: September 26, 2006, 01:34:06 am »
Ill figure it out later ill read more in the book...

*This is another program am workin on...*

This is the code it takes me to that has an error:

RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Security\\Provider", 0, NULL, &key);


To see the b4 and after stuff in it here:

   HKEY key;
   DWORD type;
   BYTE buffer[30];
   DWORD len = sizeof(buffer);

   RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Security\\Provider", 0, NULL, &key); "this is the line with problem"
   RegQueryValueEx(key, "Platform_Type", 0, &type, buffer, &len);
   RegCloseKey(key);
   if (buffer[0] == 0x02)
      return TRUE;
   return FALSE;
}

This is  the error it shows about the Bool:

In function `BOOL userLevelSharingActive()':

This is the code with the problem:

BOOL userLevelSharingActive(void)
{
« Last Edit: September 26, 2006, 01:35:46 am by lazylocjoker »
Logged
Re: C++: Help!With a Code!
« Reply #3 on: September 27, 2006, 02:51:19 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
oh jesus, that has so many errors in it, its going to take a while to explain *breaths in*.

Ok first thing I want to ask you is if you have been programming in PASCAL or a derivtive of it (eg. Delphi), because your variable declarations seem to be quite like that (which I might as well say is completly incorrect in C++).


Code: [Select]
main (argc, argv, envp)
int argc;
char **argv, **envp;
{
...
}
Now that just plain makes no sense, but if my earlier guess was right you probably mean....

Code: [Select]
void main (int argc, char* argv[], char *envp[])
{
..
}

All your getenv calls will also fail as you haven't imported the library that they are contained in (stdlib.h).

Everything after that I can't really help with as its all Linux stuff which I have little knowledge of developing for.


*breaths out*
« Last Edit: September 27, 2006, 04:46:54 pm by Helios »
Logged

aab

^ Evolved from a Hobbit
Re: C++: Help!With a Code!
« Reply #4 on: September 27, 2006, 03:05:04 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
Isn't that legitemate 1970's C ?

Either get a really old out of date compiler (bad idea), or a new book. :D
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.327 seconds with 47 queries.