uunicorn-sandbox-argv-dispatch.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. diff --git a/hello.cc b/hello.cc
  2. index b1a095c..4ac10d0 100644
  3. --- a/hello.cc
  4. +++ b/hello.cc
  5. @@ -1489,7 +1489,7 @@ operator << (std::basic_ostream<wchar_t> &os, WINBIO_REGISTERED_FORMAT r)
  6. return os << L"Owher=" << r.Owner << L", Type=" << r.Type;
  7. }
  8. -void
  9. +int
  10. identifyFeatureSet()
  11. {
  12. //char ibuf[0x2000] = { 0 };
  13. @@ -1507,9 +1507,17 @@ identifyFeatureSet()
  14. for(LONG_PTR i=0;i<req.informationSize;i++)
  15. printf("%02x", obuf[i]);
  16. printf("\n");
  17. +
  18. + /* A sensor match returns the stored identify record; a no-match result is
  19. + a zeroed structure (only a WinBio error dword further in is set).
  20. + Detect a record by its non-zero type/size header. */
  21. + int matched = req.informationSize >= 8 && (obuf[0] | obuf[1] | obuf[2] | obuf[3] |
  22. + obuf[4] | obuf[5] | obuf[6] | obuf[7]);
  23. + printf(matched ? "MATCH: identify record found\n" : "NO MATCH\n");
  24. + return matched ? 0 : 1;
  25. }
  26. -void
  27. +int
  28. identify()
  29. {
  30. char ibuf[1024*10];
  31. @@ -1595,7 +1603,7 @@ identify()
  32. printf("sz=%lld\n", (PUCHAR)(hdr+1) - data->CaptureData.Data);
  33. }
  34. }
  35. - identifyFeatureSet();
  36. + return identifyFeatureSet();
  37. }
  38. void
  39. @@ -1646,7 +1654,7 @@ reset()
  40. printf("\r\n");
  41. }
  42. -void
  43. +int
  44. enroll()
  45. {
  46. Sleep(500);
  47. @@ -1749,6 +1757,8 @@ enroll()
  48. Sleep(1000);
  49. commitEnrollment();
  50. +
  51. + return 0;
  52. }
  53. void
  54. @@ -2398,9 +2408,10 @@ struct breakpoint breakpoints[] = {
  55. { "00000001800D8C34", (unsigned char *)0x00000001800D8C34, handle_export_out },
  56. };
  57. -void
  58. +int
  59. nop()
  60. {
  61. + return 0;
  62. }
  63. void
  64. @@ -2414,10 +2425,9 @@ int
  65. main(int argc, char *argv[])
  66. {
  67. char *br = getenv("SANDBOX_BREAKPOINTS");
  68. - void (*what)();
  69. + int (*what)();
  70. IClassFactory *fact = 0;
  71. -#if 0
  72. if(argc != 2) {
  73. usage();
  74. return 3;
  75. @@ -2436,7 +2446,6 @@ main(int argc, char *argv[])
  76. usage();
  77. return 3;
  78. }
  79. -#endif
  80. HMODULE pDll = LoadLibrary("synawudfbiousb.dll");
  81. if(!pDll) {
  82. @@ -2542,16 +2551,26 @@ main(int argc, char *argv[])
  83. setMode(2); // WINBIO_SENSOR_ADVANCED_MODE
  84. - //what();
  85. - enroll();
  86. -
  87. - printf("======================================================\r\n");
  88. - printf("Sleeping 10 secons....\r\n");
  89. - printf("======================================================\r\n");
  90. - Sleep(10000);
  91. + int status = 0;
  92. +
  93. + if(what == enroll) {
  94. + enroll();
  95. +
  96. + printf("======================================================\r\n");
  97. + printf("Sleeping 10 secons....\r\n");
  98. + printf("======================================================\r\n");
  99. + Sleep(10000);
  100. - identify();
  101. + status = identify();
  102. + }
  103. + else if(what == identify) {
  104. + status = identify();
  105. + }
  106. + else {
  107. + status = what(); /* nop */
  108. + }
  109. printf("about to de-init\r\n");
  110. inst->OnDeinitialize(aDriver);
  111. + return status;
  112. }