VS2005 WinXP PROJECTS and VS2005 WinVista PROJECTS Problems........

This is a discussion on VS2005 WinXP PROJECTS and VS2005 WinVista PROJECTS Problems........ within the C Programming forums, part of the General Programming Boards category; hi, I'm having trouble using VS2005 projects in windows vista, that were created on winXP Home. The program that was ...

  1. #1
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194

    VS2005 WinXP PROJECTS and VS2005 WinVista PROJECTS Problems........

    hi,

    I'm having trouble using VS2005 projects in windows vista, that were created on winXP Home.

    The program that was created on winXP works perfectly, but when i open the same project the program runs, but when i do, for example, a delete user, the program crashes.

    Does anyone have or had this experience?

    Using:
    - Windows Vista x64
    - MS Visual Studio 2005 SP1
    "Artificial Intelligence usually beats natural stupidity."

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    What do you mean 'delete a user'?, If you mean delete a user on the computer then it really depends on how you've done it.

  3. #3
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    hey!

    That was just an example.

    Ok. I'm creating a simple C program for school.
    The program was created in VS2005 on a WinXP machine.

    The program runs normaly on the winXP machine, were it was created. The program has several of options, since the creation of users, files, etc.

    When i open the VS2005 project in my laptop, which is running vista x64, and when i compile, it doesn't give me any error or warning. So far, so good...

    But when i run the program, either using VS2005 or the .exe file, and when i select "Delete User", the program crashes and closes :-S
    All the rest is working...

    Now, what is strange is that the code is all correct, and the same program runs smoothly in the winXP machine were it was created.

    Can anyone help me now?
    "Artificial Intelligence usually beats natural stupidity."

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,470
    Could you should the code where you actually "Delete User"? What WinAPI functions you are using? Are yo checking all the return values? Probably you have not enough permissions (on Vista) to exacute some action - and as a result get the NULL pointer that you are using without check...
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  5. #5
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    but as i said, this works in the winXP machine were it was created
    Last edited by IndioDoido; 05-25-2007 at 07:09 AM.
    "Artificial Intelligence usually beats natural stupidity."

  6. #6
    Registered User
    Join Date
    May 2007
    Posts
    21
    Dont forget to install the Service Pack #1 for VS2005 -- specifically for Vista

  7. #7
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    yep!
    done it long ago...

    i even installed the most recent SP1, and nothing
    "Artificial Intelligence usually beats natural stupidity."

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    fflush(stdin);
    * Don't flush stdin, see the FAQ

    gets(directoria);
    * See the FAQ regarding gets(), use fgets instead.

    strcpy( directoria, strlen_dir(directoria) );
    * If 'strlen_dir()' returns the length of 'directoria'? Then this is incorrect, char * strcpy ( char * destination, const char * source );

    There is a few more errors in the above, for one I see a 'free' but no malloc? Even if it is in one of your other functions like check_DIR or something, you don't check if it fails or not (yes malloc can fail)

  9. #9
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    your right zacs7!

    i did what you said, i removed the free(aux); and it doesn't crash anymore, thanks alot!

    but the strange thing is, that even with the free(aux); the program runs on the machine where it was created :S
    "Artificial Intelligence usually beats natural stupidity."

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    > but the strange thing is, that even with the free(aux); the program runs on the machine where it was created
    Unfortunately, you can never equate "working" with "bug free".

    The next question is, was it really correct to not do "free(aux)", or is it just a case of if you don't do that, it just prevents it from crashing because it no longer exposes some other hidden problem in the code?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    hi Salem

    you're right...it stoped crashing but, it wasn't working well.
    i had to use free but with another variable ( free(auxD); ) and use the malloc ( auxD=malloc(sizeof(nodir)); ).

    Now its working nicely
    "Artificial Intelligence usually beats natural stupidity."

  12. #12
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Make sure you add some error checking this time...

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21