Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 28

Thread: I've written a windows keylogger in C

  1. #11
    But, lepricaun, nicer code is a bigger part of coding, why use code that isn't optimized. I recommend you get one of the begining programming books, that don't teach code, but teach theory. They will be very good for you. They will teach you to, optimize your code.

    That is one of the problems i have with my Algo's.

    Your code isn't bad, it's just the best it could be.
    yeah i know, i just started reading some tut's about optimizing code

  2. #12
    Senior Member
    Join Date
    Jul 2003
    Posts
    634
    Gotta say though, I dunno whether it was the same with you lot but when i did a C programming course at uni the bloke was obsessed with using fclose and put it everywhere as he said it was to prevent the file becoming corrupt in a crash,

    He even marked people down for not using it enough, so i dunno whether this is why you put it in loads, but i think its quite an old fashion thing to do really.

    i2c

  3. #13
    Gotta say though, I dunno whether it was the same with you lot but when i did a C programming course at uni the bloke was obsessed with using fclose and put it everywhere as he said it was to prevent the file becoming corrupt in a crash,

    He even marked people down for not using it enough, so i dunno whether this is why you put it in loads, but i think its quite an old fashion thing to do really.
    that might be why i done this too, like i said, i can't really remember, but i did it for a reason, thats for sure

  4. #14
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    i2c: I'm not advocating LEAVING THE FILE OPEN, I'm just advocating consolidating a large number of fclose() calls to one.

    Surely your tutor can't mind me using as few calls as possible, if it gets the job done?

    Other people have talked about optimisation. I'm not remotely concerned with this, I'm more concerned with tidyness and conciseness.

    If you need fclose() in 101 places in your program (and only one fopen()), it's a general indication that there's something wrong with its structure.

    Slarty

  5. #15
    Senior Member
    Join Date
    Jul 2003
    Posts
    634
    yea slarty I fully agree that the file shouldnt be left open, I was just woundering whether this might be way lepricaun was doing it,

    I do agree with you that the source should be kept concise, and agree with the argument to remove many of the fclose() statements.

    i2c

  6. #16
    Like i said before, i did it on purpose, but what exactly my reason was i can't really remember, the only thing i can think of is indeed making sure the output file is save and can be altered / removed / opened /copied whenever you want it, without having to shutdown the program

  7. #17
    Junior Member
    Join Date
    Aug 2002
    Posts
    25
    When you have a several handles allocated for a single file, it's possible (very likely) things will get corrupted. However, it's a good programming practise to exercise caution with an open file handler (and all other things). So no need to close the file every other line. After all, isn't being cautious all what programming is about ).
    There are 10 kinds of people, those who can read binary, and those who can\'t.

  8. #18
    Senior Member
    Join Date
    Aug 2003
    Posts
    224
    I tried to compile this with Dev C++. It would not complie, do I need to manually create the scvhost.log file first?
    There are many rewarding oppurtunities awaiting composure from like minds and great ideas. It in my objective to interconnect great things.

  9. #19
    Fraggin: I believe so. Don't hold me to it though. When compiling SWR 1.0 code (I am a mudder, the SWR 1.0 is a Star Wars based code base), you have to create a log file before you compile the code. In this case, create a file called "svchost.log".

    Not sure if that will work or not, havn't tried compiling this code yet (and probably won't), but Kudos to you Lepricaun, this coming from an amateur C programmer such as myself.
    Don\'t mistake lack of talent for genius.

  10. #20
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    i ran it on my computer ...it creates the log file itself. but the existance of the log file does not effect the compileing. it creates the log file at run timewhat error messages are you getting?
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •