Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <windows.h>
  4. #include <wininet.h>
  5. #include <winineti.h>
  6. #ifndef _CRTAPI1
  7. #define _CRTAPI1
  8. #endif
  9. #define IS_ARG(c) (((c) == '-') || ((c) == '/'))
  10. void _CRTAPI1 main(int, char**);
  11. void usage(void);
  12. void _CRTAPI1 main(int argc, char** argv) {
  13. LPSTR name = NULL;
  14. for (--argc, ++argv; argc; --argc, ++argv) {
  15. if (IS_ARG(**argv)) {
  16. switch (*++*argv) {
  17. default:
  18. printf("error: unrecognized command line flag: '%c'\n", **argv);
  19. usage();
  20. break;
  21. }
  22. } else if (!name) {
  23. name = *argv;
  24. } else {
  25. printf("error: unrecognized command line argument: \"%s\"\n", *argv);
  26. usage();
  27. }
  28. }
  29. if (!name) {
  30. usage();
  31. }
  32. char buffer[1024];
  33. DWORD buflen = sizeof(buffer);
  34. BOOL ok = CreateUrlCacheContainer(name,
  35. "CreatConTest",
  36. "",
  37. 10,
  38. INTERNET_CACHE_CONTAINER_AUTODELETE,
  39. 0,
  40. (LPVOID)buffer,
  41. &buflen
  42. );
  43. if (!ok) {
  44. printf("CreateUrlCacheContainer() returns %d\n", GetLastError());
  45. }
  46. printf("Done.\n");
  47. exit(0);
  48. }
  49. void usage() {
  50. printf("usage: creatcon <cache container name>\n"
  51. );
  52. exit(1);
  53. }