Advertisement
Guest User

Untitled

a guest
May 1st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. Index: Z:/projects/WindowsProjects/trunk/JSMenu.cpp
  2. ===================================================================
  3. --- Z:/projects/WindowsProjects/trunk/JSMenu.cpp (revision 984)
  4. +++ Z:/projects/WindowsProjects/trunk/JSMenu.cpp (working copy)
  5. @@ -254,8 +254,9 @@
  6. JSAPI_FUNC(my_addProfile)
  7. {
  8. // validate the args...
  9. - char *profile, *mode, *gateway, *username, *password, *charname;
  10. - if(argc != 6)
  11. + char *profile, *mode, *gateway, *username, *password, *charname, *spdifficulty;
  12. + profile = mode = gateway = username = password = charname = spdifficulty = NULL;
  13. + if(argc < 6 || argc > 7)
  14. THROW_ERROR(cx, "Invalid arguments passed to addProfile");
  15.  
  16. for(uintN i = 0; i < argc; i++)
  17. @@ -268,7 +269,11 @@
  18. username = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
  19. password = JS_GetStringBytes(JSVAL_TO_STRING(argv[4]));
  20. charname = JS_GetStringBytes(JSVAL_TO_STRING(argv[5]));
  21. - if(!profile || !mode || !gateway || !username || !password || !charname)
  22. + if(argc == 7)
  23. + spdifficulty = JS_GetStringBytes(JSVAL_TO_STRING(argv[6]));
  24. +
  25. + if(!profile || !mode || !gateway || !username || !password || !charname ||
  26. + (argc == 7 && !spdifficulty))
  27. THROW_ERROR(cx, "Failed to convert string");
  28.  
  29. char file[_MAX_FNAME+_MAX_PATH];
  30. @@ -277,9 +282,10 @@
  31. if(!ProfileExists(profile))
  32. {
  33. char settings[600];
  34. - sprintf_s(settings, sizeof(settings),
  35. - "mode=%s\0gateway=%s\0username=%s\0password=%s\0character=%s\0\0",
  36. - mode, gateway, username, password, charname);
  37. + sprintf_s(settings, sizeof(settings),
  38. + "mode=%s\0gateway=%s\0username=%s\0password=%s\0character=%s\0spdifficulty=%s\0\0",
  39. + mode, gateway, username, password, charname, spdifficulty ? spdifficulty : "3");
  40. +
  41. WritePrivateProfileSection(profile, settings, file);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement