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.

643 lines
19 KiB

  1. /*--------------------------------------------------------------------
  2. /
  3. / Screen.c
  4. /
  5. / (c) Vikram Madan, 8/26/96
  6. /
  7. / *** DO NOT REMOVE THIS CODE FROM THE WAB!!!! ***
  8. /
  9. /---------------------------------------------------------------------*/
  10. // Star == A1111
  11. // MAX_STARS == A1112
  12. // color == A1113
  13. // acc_time == A1114
  14. // acc_count == A1115
  15. // x == A1116
  16. // y == A1117
  17. // oldx == A1118
  18. // oldy == A1119
  19. // xv == A1120
  20. // yv == A1121
  21. // xa == A1122
  22. // ya == A1123
  23. // fnCredit == A1124
  24. // _Star == A1125
  25. // _NameInfo == A1126
  26. // width == A1127
  27. // delx == A1128
  28. // maxx == A1129
  29. // minx == A1130
  30. // tempx == A1131
  31. // cspace == A1132
  32. // delspace == A1133
  33. // clr == A1134
  34. // lpsz == A1135
  35. // len == A1136
  36. // THENAME_INFO == A1137
  37. // LPTHENAME_INFO == A1138
  38. // _credits == A1139
  39. // lpstar == A1140
  40. // nWidth == A1141
  41. // nHeight == A1142
  42. // hdc == A1143
  43. // hdcTemp == A1144
  44. // hWndPic == A1145
  45. // Names == A1146
  46. // rc == A1147
  47. // hbrBlack == A1148
  48. // hbm == A1149
  49. // hbmOld == A1150
  50. // CREDITS == A1151
  51. // LPCREDITS == A1152
  52. // Reset == A1153
  53. // MoveStars == A1154
  54. // InitStars == A1155
  55. // lpcr == A1156
  56. // InitStar == A1157
  57. // ReInitStar == A1158
  58. // InitNames == A1159
  59. // srandom == A1160
  60. // seed == A1161
  61. // random == A1162
  62. // ID_TIMER == A1163
  63. // TIME_OUT == A1164
  64. // cr_hWnd == A1165
  65. // cr_hdc == A1166
  66. // cr_hdcTemp == A1167
  67. // cr_Names == A1168
  68. // cr_rc == A1169
  69. // cr_hbrBlack == A1170
  70. // cr_hbm == A1171
  71. // cr_hbmOld == A1172
  72. // cr_star == A1173
  73. // nCycle == A1174
  74. // hPen == A1175
  75. // hOldPen == A1176
  76. // i == A1177
  77. // count == A1178
  78. // nlen == A1179
  79. // j == A1180
  80. // k == A1181
  81. // lp == A1182
  82. // size == A1183
  83. // OldY == A1184
  84. // R == A1185
  85. // G == A1186
  86. // B == A1187
  87. // xStart == A1188
  88. // yStart == A1189
  89. // quadrant == A1190
  90. // divisor == A1191
  91. // table == A1192
  92. // t == A1193
  93. #include "_apipch.h"
  94. INT_PTR CALLBACK A1124( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  95. typedef struct A1125
  96. {
  97. int A1116,A1117;
  98. int A1118,A1119;
  99. int A1120,A1121;
  100. int A1122,A1123;
  101. COLORREF A1113;
  102. int A1114;
  103. int A1115;
  104. } A1111, * LPA1111;
  105. #define A1112 100
  106. #define NAMES_MAX 43
  107. typedef struct A1126
  108. {
  109. int A1116;
  110. int A1117;
  111. int A1127;
  112. int A1128;
  113. int A1129;
  114. int A1130;
  115. int A1131;
  116. int A1132;
  117. int A1133;
  118. COLORREF A1134;
  119. LPSTR A1135;
  120. int A1136;
  121. } A1137, * A1138;
  122. typedef struct A1139
  123. {
  124. LPA1111 A1140;
  125. int A1141,A1142;
  126. HDC A1143;
  127. HDC A1144;
  128. HWND A1145;
  129. A1137 * A1146;
  130. RECT A1147;
  131. HBRUSH A1148;
  132. HBITMAP A1149;
  133. HBITMAP A1150;
  134. } A1151, *A1152;
  135. void A1153(HWND hWnd, HDC A1143, A1138 A1146);
  136. void A1154(A1152 A1156);
  137. void A1155(A1152 A1156);
  138. void A1157(LPA1111 A1140);
  139. void A1158(LPA1111 A1140);
  140. void A1159(A1138 A1146);
  141. void A1160(unsigned int A1161);
  142. int A1162(void);
  143. #define A1163 999
  144. #define A1164 25
  145. int A1141,A1142;
  146. void SCS(HWND hwndParent)
  147. {
  148. A1152 A1156 = LocalAlloc(LMEM_ZEROINIT, sizeof(A1151));
  149. if(A1156)
  150. {
  151. if(!(A1156->A1140 = LocalAlloc(LMEM_ZEROINIT, sizeof(A1111)*A1112)))
  152. return;
  153. if(!(A1156->A1146 = LocalAlloc(LMEM_ZEROINIT, sizeof(A1137)*NAMES_MAX)))
  154. return;
  155. A1160 ((UINT) GetTickCount());
  156. DialogBoxParamA(
  157. hinstMapiX,
  158. (LPCSTR) MAKEINTRESOURCE(IDD_FORMVIEW),
  159. hwndParent,
  160. A1124,
  161. (LPARAM) A1156);
  162. {
  163. int A1177;
  164. for(A1177=0;A1177<NAMES_MAX;A1177++)
  165. {
  166. if(A1156->A1146[A1177].A1135)
  167. LocalFree(A1156->A1146[A1177].A1135);
  168. }
  169. }
  170. if(A1156->A1146)
  171. LocalFree(A1156->A1146);
  172. if(A1156->A1140)
  173. LocalFree(A1156->A1140);
  174. LocalFree(A1156);
  175. }
  176. return;
  177. }
  178. #define A1165 A1156->A1145
  179. #define A1166 A1156->A1143
  180. #define A1167 A1156->A1144
  181. #define A1168 (A1156->A1146)
  182. #define A1169 (A1156->A1147)
  183. #define A1170 A1156->A1148
  184. #define A1171 A1156->A1149
  185. #define A1172 A1156->A1150
  186. #define A1173 A1156->A1140
  187. INT_PTR CALLBACK A1124(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  188. {
  189. int A1177;
  190. A1152 A1156 = (A1152) GetWindowLongPtr(hDlg, DWLP_USER);
  191. switch(message)
  192. {
  193. case WM_INITDIALOG:
  194. A1156 = (A1152) lParam;
  195. SetWindowLongPtrA(hDlg, DWLP_USER, lParam);
  196. A1165 = GetDlgItem(hDlg,IDC_PIC);
  197. GetClientRect(A1165, &A1169);
  198. A1141 = A1169.right;
  199. A1142 = A1169.bottom;
  200. A1166 = GetDC(A1165);
  201. A1167 = CreateCompatibleDC(A1166);
  202. A1171 = CreateCompatibleBitmap(A1166, A1141, A1142);
  203. A1172 = SelectObject(A1167, A1171);
  204. SetBkColor(A1167, RGB(0,0,0));
  205. SetTextColor(A1167, RGB(255,255,0));
  206. SetBkMode(A1167, TRANSPARENT);
  207. A1170 = GetStockObject(BLACK_BRUSH);
  208. SetTimer(hDlg, A1163, A1164, NULL);
  209. A1155(A1156);
  210. A1159(A1168);
  211. A1153(A1165, A1167, A1168);
  212. break;
  213. case WM_TIMER:
  214. {
  215. static int A1174 = 0;
  216. IF_WIN32(if (hDlg != GetForegroundWindow()))
  217. IF_WIN16(if (hDlg != GetFocus()))
  218. SendMessage (hDlg, WM_COMMAND, (WPARAM) IDCANCEL, 0);
  219. A1174++;
  220. if(A1174 > 4)
  221. A1174 = 0;
  222. FillRect(A1167, &A1169, A1170);
  223. A1154(A1156);
  224. for(A1177=0;A1177<A1112;A1177++)
  225. {
  226. HPEN A1175 = CreatePen(PS_SOLID,0,(A1173[A1177]).A1113);
  227. HPEN A1176 = SelectObject(A1167, A1175);
  228. MoveToEx(A1167, A1173[A1177].A1118,A1173[A1177].A1119,NULL);
  229. LineTo(A1167, A1173[A1177].A1116, A1173[A1177].A1117);
  230. SelectObject(A1167, A1176);
  231. DeleteObject(A1175);
  232. }
  233. A1168[0].A1117--;
  234. for(A1177=1;A1177<NAMES_MAX;A1177++)
  235. {
  236. A1168[A1177].A1117--;
  237. if(A1174 == 1)
  238. {
  239. A1168[A1177].A1132 += A1168[A1177].A1133;
  240. if(A1168[A1177].A1132 == 0 || A1168[A1177].A1132 == 3)
  241. A1168[A1177].A1133 *= -1;
  242. }
  243. A1168[A1177].A1131 += A1168[A1177].A1128;
  244. if(A1168[A1177].A1131 <= A1168[A1177].A1130 || A1168[A1177].A1131 >= A1168[A1177].A1129)
  245. A1168[A1177].A1128 *= -1;
  246. }
  247. for(A1177=0;A1177<NAMES_MAX;A1177++)
  248. {
  249. if (A1168[A1177].A1117 < 0)
  250. continue;
  251. if (A1168[A1177].A1117 > A1142)
  252. break;
  253. SetTextColor(A1167, A1168[A1177].A1134);
  254. SetTextCharacterExtra(A1167, A1168[A1177].A1132);
  255. TextOutA(A1167,
  256. (A1177==0) ? A1168[A1177].A1116 :A1168[A1177].A1131 - ((A1168[A1177].A1136-1)*A1168[A1177].A1132)/2,
  257. A1168[A1177].A1117, A1168[A1177].A1135, A1168[A1177].A1136);
  258. }
  259. BitBlt(A1166, 0, 0, A1141, A1142, A1167, 0, 0, SRCCOPY);
  260. if(A1168[NAMES_MAX-1].A1117 < 0)
  261. {
  262. A1153(A1165, A1167, A1168);
  263. }
  264. }
  265. break;
  266. case WM_COMMAND:
  267. switch (GET_WM_COMMAND_ID(wParam, lParam))
  268. {
  269. case IDCANCEL:
  270. KillTimer(hDlg, A1163);
  271. if(A1166)
  272. {
  273. ReleaseDC(A1165, A1166);
  274. A1166 = NULL;
  275. }
  276. if(A1171)
  277. {
  278. SelectObject(A1167, A1172);
  279. DeleteObject(A1171);
  280. A1171 = NULL;
  281. }
  282. if(A1167)
  283. {
  284. DeleteDC(A1167);
  285. A1167 = NULL;
  286. }
  287. EndDialog(hDlg, 1);
  288. break;
  289. }
  290. break;
  291. case WM_CLOSE:
  292. case WM_KEYDOWN:
  293. case WM_SYSKEYDOWN:
  294. case WM_CHAR:
  295. case WM_KILLFOCUS:
  296. case WM_LBUTTONDOWN:
  297. case WM_RBUTTONDOWN:
  298. case WM_MBUTTONDOWN:
  299. case WM_LBUTTONUP:
  300. case WM_RBUTTONUP:
  301. case WM_MBUTTONUP:
  302. SendMessage (hDlg, WM_COMMAND, (WPARAM) IDCANCEL, 0);
  303. break;
  304. default:
  305. return FALSE;
  306. break;
  307. }
  308. return TRUE;
  309. }
  310. // very simple name encryption
  311. //
  312. // If you work on the WAB, you are welcome to add your name to the list below.. however, do not ever ever ever
  313. // remove any name from this list.
  314. // Each line that will be displayed on the screen should be represented as a seperate line in the array below.
  315. // The first number in each line is the count of all characters that will be in that line.
  316. // The encryption is simple with an 'a' subtracted from each character of the name. A key is provided for your
  317. // convenience.
  318. // When you have added a name to the WAB, you should then increment the NAMES_MAX constant by the number of lines
  319. // you have added to the array below. Include all blank and 1 character lines in the count.
  320. // The list below is in approximate chronological order order so please maintain that by adding
  321. // additional names to the bottom
  322. // ... and oh, you need to increase the NAMES_MAX structure by the added number of lines..
  323. //
  324. // Steps to trigger the credit screen:
  325. // 1. Open WAB Main Window
  326. // 2. Make sure you have atleast 1 entry in the List View
  327. // 3. Select View Menu > Large Icon
  328. // 4. Select View Menu > Sort By > Last Name
  329. // 5. Make sure atleast 1 entry is selected in the List View
  330. // 6. Press Ctrl Key + Alt Key + Shift Key all together and keep them pressed
  331. // 7. Select File Menu > Properties
  332. // 8. voila!
  333. //
  334. // The Key (for adding more names is)
  335. // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  336. // -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7
  337. //
  338. // a b c d e f g h i j k l m n o p q r s t u v w x y z
  339. // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21> 22 23 24 25
  340. //
  341. //
  342. //
  343. static const signed char nm[] =
  344. {
  345. // // W i n d o w s A d d r e s s B o o k
  346. 20,-10,8,13,3,14,22,18,-65,-32,3,3,17,4,18,18,-65,-31,14,14,10,
  347. 1,-65,
  348. 1,-65,
  349. // B r u c e K e l l e y
  350. 12,-31,17,20,2,4,-65,-22,4,11,11,4,24,
  351. 1,-65,
  352. // V i k r a m M a d a n
  353. 12,-11,8,10,17,0,12,-65,-20,0,3,0,13,
  354. 1,-65,
  355. // Y o r a m Y a a c o v i
  356. 13,-8,14,17,0,12,-65,-8,0,0,2,14,21,8,
  357. 1,-65,
  358. // J e a n K a i s e r
  359. 11,-23,4,0,13,-65,-22,0,8,18,4,17,
  360. 1,-65,
  361. // M e a d H i m e l s t e i n
  362. 15,-20,4,0,3,-65,-25,8,12,4,11,18,19,4,8,13,
  363. 1,-65,
  364. // T e o m a n S m i t h
  365. 12,-13,4,14,12,0,13,-65,-14,12,8,19,7,
  366. 1,-65,
  367. // M a r k D u r l e y
  368. 11,-20,0,17,10,-65,-29,20,17,11,4,24,
  369. 1,-65,
  370. // W i l l i a m L a i
  371. 11,-10,8,11,11,8,0,12,-65,-21,0,8,
  372. 1,-65,
  373. // E r i c B e r m a n
  374. 11,-28,17,8,2,-65,-31,4,17,12,0,13,
  375. 1,-65,
  376. // S u s a n H i g g s
  377. 11,-14,20,18,0,13,-65,-25,8,6,6,18,
  378. 1,-65,
  379. // G e o r g e H a t o u n
  380. 13, -26, 4, 14, 17, 6, 4, -65, -25, 0, 19, 14, 20, 13,
  381. 1, -65,
  382. // J o h n T a f o y a
  383. 11,-23,14,7,13,-65,-13,0,5,14,24,0,
  384. 1,-65,
  385. // G o r d o n M c E l r o y
  386. 14,-26,14,17,3,14,13,-65,-20,2,-28,11,17,14,24,
  387. 1,-65,
  388. // L a u r e n A n t o n o f f
  389. 15,-21,0,20,17,4,13,-65,-32,13,19,14,13,14,5,5,
  390. 1,-65,
  391. // D e b r a W e i s s m a n
  392. 14,-29,4,1,17,0,-65,-10,4,8,18,18,12,0,13,
  393. 1,-65,
  394. // N e i l B r e n c h
  395. 11,-19,4,8,11,-65,-31,17,4,13,2,7,
  396. 1,-65,
  397. // C h r i s E v a n s
  398. 11,-30,7,17,8,18,-65,-28,21,0,13,18,
  399. 1,-65,
  400. // J a s o n S t a j i c h
  401. 13,-23,0,18,14,13,-65,-14,19,0,9,8,2,7,
  402. 1,-65,
  403. // C h r i s D r e h e r
  404. 12,-30,7,17,8,18,-65,-29,17,4, 7,4, 17,
  405. 1,-65,
  406. // W e i B i n g Z h a n
  407. 12, -10, 4, 8, -31, 8, 13, 6, -65, -7, 7, 0, 13,
  408. 1, -65,
  409. };
  410. void A1159(A1138 A1146)
  411. {
  412. int A1177;
  413. int A1178 = 0;
  414. for(A1177=0;A1177<NAMES_MAX;A1177++)
  415. {
  416. int A1179 = nm[A1178++];
  417. int A1180;
  418. LPSTR A1182 = LocalAlloc(LMEM_ZEROINIT, A1179+1);
  419. A1146[A1177].A1135 = NULL;;
  420. if(!A1182)
  421. {
  422. DebugTrace(TEXT("InitStar LocalAlloc failed allocating %d bytes - error = %d\n"), (A1179+1), GetLastError());
  423. for(A1180=0;A1180<A1179;A1180++)
  424. A1178++;
  425. continue;
  426. }
  427. for(A1180=0;A1180<A1179;A1180++)
  428. A1182[A1180] = nm[A1178++] + 'a';
  429. A1182[A1179]='\0';
  430. A1146[A1177].A1135 = A1182;
  431. A1146[A1177].A1136 = A1179;
  432. }
  433. return;
  434. }
  435. void A1153(HWND hWnd, HDC A1143, A1138 A1146)
  436. {
  437. RECT A1147;
  438. SIZE A1183;
  439. int A1184 = 0;
  440. int A1177,A1180;
  441. GetClientRect(hWnd, &A1147);
  442. A1146[0].A1117 = A1147.bottom;
  443. for(A1177=0;A1177<NAMES_MAX;A1177++)
  444. {
  445. GetTextExtentPoint32A(A1143,(LPSTR) A1146[A1177].A1135,A1146[A1177].A1136,&A1183);
  446. A1146[A1177].A1127 = A1183.cx;
  447. A1146[A1177].A1131 = A1146[A1177].A1116 = (A1147.right-A1183.cx)/2;
  448. A1146[A1177].A1129 = A1146[A1177].A1116 * 2 - 10;
  449. A1146[A1177].A1130 = 10;
  450. A1146[A1177].A1128 = A1162()%2 ? -1 : 1;
  451. A1146[A1177].A1134 = RGB(A1162()%128+128,A1162()%128+128,A1162()%192+64);
  452. A1146[A1177].A1133 = A1162()%2 ? -1 : 1;
  453. A1146[A1177].A1132 = 2;
  454. if(A1177>0)
  455. A1146[A1177].A1117 = A1146[A1177-1].A1117+A1184+1;
  456. A1184 = A1183.cy;
  457. }
  458. A1146[0].A1134 = RGB(255,255,0);
  459. A1146[0].A1128 = 0;
  460. A1146[0].A1133 = 0;
  461. A1146[0].A1132 = 0;
  462. for(A1177=1;A1177<NAMES_MAX;A1177++)
  463. {
  464. for(A1180=0;A1180<A1177;A1180++)
  465. {
  466. A1146[A1177].A1131 += A1146[A1177].A1128;
  467. if(A1146[A1177].A1131 <= A1146[A1177].A1130 || A1146[A1177].A1131 >= A1146[A1177].A1129)
  468. A1146[A1177].A1128 *= -1;
  469. }
  470. }
  471. return;
  472. }
  473. void A1157(LPA1111 A1140)
  474. {
  475. int A1185 = A1162()%256;
  476. int A1186 = A1162()%256;
  477. int A1187 = A1162()%256;
  478. A1140->A1113 = RGB(A1185,A1186,A1187);
  479. A1158(A1140);
  480. A1140->A1114 = 1 + A1162()%3;
  481. return;
  482. }
  483. void A1158(LPA1111 A1140)
  484. {
  485. int A1188 = A1141/4;
  486. int A1189 = A1142/4;
  487. int A1190 = ((int)A1162()%4);
  488. int A1191 = 1 + (A1162()%3);
  489. switch(A1190)
  490. {
  491. case 0:
  492. A1140->A1116 = 2*A1188 + A1162()%(A1188);
  493. A1140->A1117 = A1189 + A1162()%(A1189);
  494. A1140->A1120 = 1+(A1162()%3);
  495. A1140->A1121 = -1-(A1162()%3);
  496. break;
  497. case 1:
  498. A1140->A1116 = 2*A1188 + A1162()%(A1188);
  499. A1140->A1117 = 2*A1189 + A1162()%(A1189);
  500. A1140->A1120 = 1+(A1162()%3);
  501. A1140->A1121 = 1+(A1162()%3);
  502. break;
  503. case 2:
  504. A1140->A1116 = A1188 + A1162()%(A1188);
  505. A1140->A1117 = 2*A1189 + A1162()%(A1189);
  506. A1140->A1120 = -1-(A1162()%3);
  507. A1140->A1121 = 1+(A1162()%3);
  508. break;
  509. case 3:
  510. A1140->A1116 = A1188 + A1162()%(A1188);
  511. A1140->A1117 = A1189 + A1162()%(A1189);
  512. A1140->A1120 = -1-(A1162()%3);
  513. A1140->A1121 = -1-(A1162()%3);
  514. break;
  515. }
  516. A1140->A1118 = A1140->A1116 - A1140->A1120;
  517. A1140->A1119 = A1140->A1117 - A1140->A1121;
  518. A1140->A1122 = A1140->A1120/A1191;
  519. A1140->A1123 = A1140->A1121/A1191;
  520. A1140->A1115 = 0;
  521. return;
  522. }
  523. void A1155(A1152 A1156)
  524. {
  525. int A1177;
  526. for(A1177=0;A1177<A1112;A1177++)
  527. {
  528. A1157(&(A1173[A1177]));
  529. }
  530. return;
  531. }
  532. void A1154(A1152 A1156)
  533. {
  534. int A1177;
  535. for(A1177=0;A1177<A1112;A1177++)
  536. {
  537. A1173[A1177].A1118 = A1173[A1177].A1116;
  538. A1173[A1177].A1119 = A1173[A1177].A1117;
  539. A1173[A1177].A1116 += A1173[A1177].A1120;
  540. A1173[A1177].A1117 += A1173[A1177].A1121;
  541. if(
  542. (A1173[A1177].A1116 < 0) ||
  543. (A1173[A1177].A1117 < 0) ||
  544. (A1173[A1177].A1116 > A1141) ||
  545. (A1173[A1177].A1117 > A1142))
  546. A1158(&A1173[A1177]);
  547. if (++A1173[A1177].A1115 == A1173[A1177].A1114)
  548. {
  549. A1173[A1177].A1115 = 0;
  550. A1173[A1177].A1120 += A1173[A1177].A1122;
  551. A1173[A1177].A1121 += A1173[A1177].A1123;
  552. }
  553. }
  554. return;
  555. }
  556. static int A1192[55];
  557. static int A1180, A1181;
  558. void A1160(unsigned int A1161)
  559. {
  560. int A1177;
  561. A1192[0] = A1161;
  562. for ( A1177 = 1 ; A1177 < 55 ; A1177++ )
  563. {
  564. A1192[A1177] = A1192[A1177-1] * 3;
  565. A1192[A1177] += 715827883;
  566. }
  567. A1180 = 22;
  568. A1181 = 54;
  569. }
  570. int A1162(void)
  571. {
  572. unsigned int A1193;
  573. if (A1180 < 0)
  574. {
  575. A1160(0x8091A2B3);
  576. }
  577. A1193 = A1192[A1180] + A1192[A1181]; // overflow is ok.
  578. A1192[A1181] = A1193;
  579. A1180 = ( A1180 ) ? (A1180 - 1) : 54;
  580. A1181 = ( A1181 ) ? (A1181 - 1) : 54;
  581. return (int)(A1193 >> 1);
  582. }