1064{
1068 DWORD neededW, returnedW;
1069 DWORD tempneeded, tempreturned, missing;
1070 DWORD servicecountactive, servicecountinactive;
1075
1076
1079 ok(!
ret,
"Expected failure\n");
1081 "Expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
1082
1085 ok(!
ret,
"Expected failure\n");
1087 "Expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
1088
1089
1091
1092
1095 ok(!
ret,
"Expected failure\n");
1099
1102 ok(!
ret,
"Expected failure\n");
1106
1107
1108 returned = 0xdeadbeef;
1111 ok(!
ret,
"Expected failure\n");
1112 ok(returned == 0xdeadbeef,
"Expected no change to the number of services variable\n");
1116
1117 returned = 0xdeadbeef;
1120 ok(!
ret,
"Expected failure\n");
1121 ok(returned == 0xdeadbeef,
"Expected no change to the number of services variable\n");
1125
1126
1127 needed = 0xdeadbeef;
1130 ok(!
ret,
"Expected failure\n");
1131 ok(needed == 0xdeadbeef ||
broken(needed != 0xdeadbeef),
1132 "Expected no change to the needed buffer variable\n");
1136
1137 needed = 0xdeadbeef;
1140 ok(!
ret,
"Expected failure\n");
1141 ok(needed == 0xdeadbeef ||
broken(needed != 0xdeadbeef),
1142 "Expected no change to the needed buffer variable\n");
1146
1147
1148 needed = 0xdeadbeef;
1149 returned = 0xdeadbeef;
1152 ok(!
ret,
"Expected failure\n");
1153 ok(needed == 0 ||
broken(needed != 0),
1154 "Expected needed buffer size to be set to 0, got %d\n", needed);
1155 ok(returned == 0,
"Expected number of services to be set to 0, got %d\n", returned);
1157 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1158
1159 needed = 0xdeadbeef;
1160 returned = 0xdeadbeef;
1163 ok(!
ret,
"Expected failure\n");
1164 ok(needed == 0 ||
broken(needed != 0),
1165 "Expected needed buffer size to be set to 0, got %d\n", needed);
1166 ok(returned == 0 ||
broken(returned != 0),
1167 "Expected number of services to be set to 0, got %d\n", returned);
1169 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1170
1171
1172 needed = 0xdeadbeef;
1173 returned = 0xdeadbeef;
1176 ok(!
ret,
"Expected failure\n");
1177 ok(needed == 0 ||
broken(needed != 0),
1178 "Expected needed buffer size to be set to 0, got %d\n", needed);
1179 ok(returned == 0,
"Expected number of services to be set to 0, got %d\n", returned);
1181 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1182
1183 needed = 0xdeadbeef;
1184 returned = 0xdeadbeef;
1187 ok(!
ret,
"Expected failure\n");
1188 ok(needed == 0 ||
broken(needed != 0),
1189 "Expected needed buffer size to be set to 0, got %d\n", needed);
1190 ok(returned == 0 ||
broken(returned != 0),
1191 "Expected number of services to be set to 0, got %d\n", returned);
1193 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1194
1195
1196 needed = 0xdeadbeef;
1197 returned = 0xdeadbeef;
1200 ok(!
ret,
"Expected failure\n");
1201 ok(needed == 0 ||
broken(needed != 0),
1202 "Expected needed buffer size to be set to 0, got %d\n", needed);
1203 ok(returned == 0,
"Expected number of services to be set to 0, got %d\n", returned);
1205 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1206
1207 needed = 0xdeadbeef;
1208 returned = 0xdeadbeef;
1211 ok(!
ret,
"Expected failure\n");
1212 ok(needed == 0 ||
broken(needed != 0),
1213 "Expected needed buffer size to be set to 0, got %d\n", needed);
1214 ok(returned == 0 ||
broken(returned != 0),
1215 "Expected number of services to be set to 0, got %d\n", returned);
1217 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1218
1219
1220 needed = 0xdeadbeef;
1221 returned = 0xdeadbeef;
1224 ok(!
ret,
"Expected failure\n");
1225 ok(needed == 0 ||
broken(needed != 0),
1226 "Expected needed buffer size to be set to 0, got %d\n", needed);
1227 ok(returned == 0,
"Expected number of services to be set to 0, got %d\n", returned);
1229 "Expected ERROR_ACCESS_DENIED, got %d\n",
GetLastError());
1230
1231 needed = 0xdeadbeef;
1232 returned = 0xdeadbeef;
1235 ok(!
ret,
"Expected failure\n");
1236 ok(needed == 0 ||
broken(needed != 0),
1237 "Expected needed buffer size to be set to 0, got %d\n", needed);
1238 ok(returned == 0 ||
broken(returned != 0),
1239 "Expected number of services to be set to 0, got %d\n", returned);
1241 "Expected ERROR_ACCESS_DENIED, got %d\n",
GetLastError());
1242
1243
1246
1247
1248 needed = 0xdeadbeef;
1249 returned = 0xdeadbeef;
1252 ok(!
ret,
"Expected failure\n");
1253 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size for this one service\n");
1254 ok(returned == 0,
"Expected no service returned, got %d\n", returned);
1257
1258
1259 neededW = 0xdeadbeef;
1260 returnedW = 0xdeadbeef;
1263 ok(!
ret,
"Expected failure\n");
1264 ok(neededW != 0xdeadbeef && neededW > 0,
"Expected the needed buffer size for this one service\n");
1265 ok(neededW == needed,
"Expected needed buffersize to be the same for A- and W-calls\n");
1266 ok(returnedW == 0,
"Expected no service returned, got %d\n", returnedW);
1269
1270
1271 tempneeded = needed;
1272
1273
1276 needed = 0xdeadbeef;
1277 returned = 0xdeadbeef;
1282 ok(needed == 0,
"Expected needed buffer to be 0 as we are done\n");
1283 ok(returned != 0xdeadbeef && returned > 0,
"Expected some returned services\n");
1285
1286
1287 tempreturned = returned;
1288
1291 neededW = 0xdeadbeef;
1292 returnedW = 0xdeadbeef;
1297 ok(neededW == 0,
"Expected needed buffer to be 0 as we are done\n");
1298 ok(returnedW != 0xdeadbeef && returnedW > 0,
"Expected some returned services\n");
1300
1301
1304 needed = 0xdeadbeef;
1305 returned = 0xdeadbeef;
1309 ok(!
ret,
"Expected failure\n");
1310 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size for this one service\n");
1311 ok(returned < tempreturned,
"Expected fewer services to be returned\n");
1314
1315
1317 needed = 0xdeadbeef;
1318 returned = 0xdeadbeef;
1319 resume = 0;
1323 ok(!
ret,
"Expected failure\n");
1324 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size for this one service\n");
1325 ok(returned < tempreturned,
"Expected fewer services to be returned\n");
1326 todo_wine ok(resume,
"Expected a resume handle\n");
1329
1330
1331 missing = tempreturned - returned;
1333 needed = 0xdeadbeef;
1334 returned = 0xdeadbeef;
1339 ok(needed == 0,
"Expected needed buffer to be 0 as we are done\n");
1340 ok(returned == missing,
"Expected %u services to be returned\n", missing);
1341 ok(resume == 0,
"Expected the resume handle to be 0\n");
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1358 &needed, &returned,
NULL);
1361 needed, &needed, &returned,
NULL);
1363
1364 servicecountactive = returned;
1365
1366
1368 &needed, &returned,
NULL);
1371 needed, &needed, &returned,
NULL);
1373
1374 servicecountinactive = returned;
1375
1376
1378 &needed, &returned,
NULL);
1381 needed, &needed, &returned,
NULL);
1383
1384
1385 ok(returned == (servicecountactive + servicecountinactive),
1386 "Something wrong in the calculation\n");
1387
1388
1389
1390
1391
1392
1394 NULL, 0, &needed, &returned,
NULL);
1398
1399
1400 for (
i = 0;
ret &&
i < returned;
i++)
1401 {
1403
1404
1405 ok(
services[
i].lpServiceName[0],
"Expected a service name\n");
1407
1408
1409
1410
1412 {
1414 servicecountinactive--;
1415 else
1416 servicecountactive--;
1417 }
1418 }
1420
1421 ok(servicecountactive == 0,
"Active services mismatch %u\n", servicecountactive);
1422 ok(servicecountinactive == 0,
"Inactive services mismatch %u\n", servicecountinactive);
1423
1425
1426
1427 if (!pEnumServicesStatusExA)
1428 {
1429 win_skip(
"EnumServicesStatusExA not available\n" );
1430 return;
1431 }
1432
1433
1436 ok(!
ret,
"Expected failure\n");
1438 "Expected ERROR_INVALID_LEVEL, got %d\n",
GetLastError());
1439
1440
1443 ok(!
ret,
"Expected failure\n");
1445 "Expected ERROR_INVALID_HANDLE, got %d\n",
GetLastError());
1446
1447
1449
1450
1453 ok(!
ret,
"Expected failure\n");
1457
1458
1459 needed = 0xdeadbeef;
1462 ok(!
ret,
"Expected failure\n");
1463 ok(needed == 0xdeadbeef ||
broken(needed != 0xdeadbeef),
1464 "Expected no change to the needed buffer variable\n");
1468
1469
1470 returned = 0xdeadbeef;
1473 ok(!
ret,
"Expected failure\n");
1474 ok(returned == 0xdeadbeef,
"Expected no change to the number of services variable\n");
1478
1479
1480 needed = 0xdeadbeef;
1481 returned = 0xdeadbeef;
1484 ok(!
ret,
"Expected failure\n");
1485 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1486 ok(needed == 0 ||
broken(needed != 0),
1487 "Expected needed buffer size to be set to 0, got %d\n", needed);
1489 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1490
1491
1492 needed = 0xdeadbeef;
1493 returned = 0xdeadbeef;
1497 ok(!
ret,
"Expected failure\n");
1498 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1499 ok(needed == 0 ||
broken(needed != 0),
1500 "Expected needed buffer size to be set to 0, got %d\n", needed);
1502 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1503
1504
1505 needed = 0xdeadbeef;
1506 returned = 0xdeadbeef;
1510 ok(!
ret,
"Expected failure\n");
1511 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1512 ok(needed == 0 ||
broken(needed != 0),
1513 "Expected needed buffer size to be set to 0, got %d\n", needed);
1515 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1516
1517
1518 needed = 0xdeadbeef;
1519 returned = 0xdeadbeef;
1522 &returned,
NULL,
"deadbeef_group");
1523 ok(!
ret,
"Expected failure\n");
1524 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1525 ok(needed == 0 ||
broken(needed != 0),
1526 "Expected needed buffer size to be set to 0, got %d\n", needed);
1528 "Expected ERROR_INVALID_PARAMETER, got %d\n",
GetLastError());
1529
1530
1531 needed = 0xdeadbeef;
1532 returned = 0xdeadbeef;
1536 ok(!
ret,
"Expected failure\n");
1537 ok(needed == 0 ||
broken(needed != 0),
1538 "Expected needed buffer size to be set to 0, got %d\n", needed);
1539 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1541 "Expected ERROR_ACCESS_DENIED, got %d\n",
GetLastError());
1542
1543
1544
1545
1546 needed = 0xdeadbeef;
1547 returned = 0xdeadbeef;
1550 NULL, 0, &needed, &returned,
NULL,
"deadbeef_group");
1551 ok(!
ret,
"Expected failure\n");
1552 ok(needed == 0 ||
broken(needed != 0),
1553 "Expected needed buffer size to be set to 0, got %d\n", needed);
1554 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1556 "Expected ERROR_ACCESS_DENIED, got %d\n",
GetLastError());
1557
1558
1561
1562
1563 needed = 0xdeadbeef;
1564 returned = 0xdeadbeef;
1567 NULL, 0, &needed, &returned,
NULL,
"deadbeef_group");
1568 ok(!
ret,
"Expected failure\n");
1569 ok(returned == 0,
"Expected number of service to be set to 0, got %d\n", returned);
1570 ok(needed == 0,
"Expected needed buffer size to be set to 0, got %d\n", needed);
1572 "Expected ERROR_SERVICE_DOES_NOT_EXIST, got %d\n",
GetLastError());
1573
1574
1575
1576
1577
1578
1579 needed = 0xdeadbeef;
1580 returned = 0xdeadbeef;
1584 ok(!
ret,
"Expected failure\n");
1585 ok(returned == 0,
"Expected no service returned, got %d\n", returned);
1586 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size\n");
1589
1590
1591 neededW = 0xdeadbeef;
1594 ok(!
ret,
"Expected failure\n");
1595 ok(neededW == needed,
"Expected needed buffersize to be the same for A- and W-calls\n");
1596
1597
1598 tempneeded = needed;
1599
1600
1603 needed = 0xdeadbeef;
1604 returned = 0xdeadbeef;
1609 ok(needed == 0,
"Expected needed buffer to be 0 as we are done\n");
1610 ok(returned == tempreturned,
"Expected the same number of service from this function\n");
1612
1613
1614 tempreturned = returned;
1615
1616
1619 needed = 0xdeadbeef;
1620 returned = 0xdeadbeef;
1624 ok(!
ret,
"Expected failure\n");
1625 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size\n");
1626 ok(returned < tempreturned,
"Expected fewer services to be returned\n");
1629
1630
1632 needed = 0xdeadbeef;
1633 returned = 0xdeadbeef;
1634 resume = 0;
1638 ok(!
ret,
"Expected failure\n");
1639 ok(needed != 0xdeadbeef && needed > 0,
"Expected the needed buffer size\n");
1640 ok(returned < tempreturned,
"Expected fewer services to be returned\n");
1641 todo_wine ok(resume,
"Expected a resume handle\n");
1644
1645
1646 missing = tempreturned - returned;
1648 needed = 0xdeadbeef;
1649 returned = 0xdeadbeef;
1654 ok(needed == 0,
"Expected needed buffer to be 0 as we are done\n");
1655 ok(returned == missing,
"Expected %u services to be returned\n", missing);
1656 ok(resume == 0,
"Expected the resume handle to be 0\n");
1658
1659
1660
1661
1666 (
BYTE*)exservices, needed, &needed, &returned,
NULL,
NULL);
1668
1669 servicecountactive = returned;
1670
1671
1676 (
BYTE*)exservices, needed, &needed, &returned,
NULL,
NULL);
1678
1679 servicecountinactive = returned;
1680
1681
1686 (
BYTE*)exservices, needed, &needed, &returned,
NULL,
NULL);
1688
1689
1690 ok(returned == (servicecountactive + servicecountinactive),
1691 "Something wrong in the calculation\n");
1692
1693
1696 ok(!
ret,
"Expected failure\n");
1701
1702
1703 for (
i = 0;
i < returned;
i++)
1704 {
1706
1707
1708 ok(exservices[
i].lpServiceName[0],
"Expected a service name\n");
1710
1711
1712
1713
1714
1716 {
1717
1719 "This driver shouldn't have an associated process id\n");
1720 }
1721
1723 {
1725 {
1726
1727 ok(
status.dwProcessId > 0,
"Expected a process id for this running service (%s)\n",
1728 exservices[
i].lpServiceName);
1729
1730 servicecountactive--;
1731 }
1732 else
1733 {
1734
1735 ok(
status.dwProcessId == 0,
"Service %s state %u shouldn't have an associated process id\n",
1736 exservices[
i].lpServiceName,
status.dwCurrentState);
1737
1738 servicecountinactive--;
1739 }
1740 }
1741 }
1743
1744 ok(servicecountactive == 0,
"Active services mismatch %u\n", servicecountactive);
1745 ok(servicecountinactive == 0,
"Inactive services mismatch %u\n", servicecountinactive);
1746
1748}
#define HeapFree(x, y, z)
GLenum GLuint GLsizei bufsize
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI EnumServicesStatusA(SC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle)
BOOL WINAPI EnumServicesStatusW(SC_HANDLE hSCManager, DWORD dwServiceType, DWORD dwServiceState, LPENUM_SERVICE_STATUSW lpServices, DWORD cbBufSize, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle)
SERVICE_STATUS_PROCESS ServiceStatusProcess
_In_ LPCSTR _Out_writes_to_opt_ cchDisplayName LPSTR lpDisplayName
#define ERROR_INVALID_LEVEL
#define ERROR_SERVICE_DOES_NOT_EXIST
#define SERVICE_STATE_ALL
#define SC_MANAGER_ENUMERATE_SERVICE