Changeset 8644 for trunk/src/kernel32
- Timestamp:
- Jun 11, 2002, 2:52:03 PM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmcomm.cpp
r7605 r8644 1 /* $Id: hmcomm.cpp,v 1.3 4 2001-12-10 14:04:24sandervl Exp $ */1 /* $Id: hmcomm.cpp,v 1.35 2002-06-11 12:51:43 sandervl Exp $ */ 2 2 3 3 /* … … 297 297 PHMHANDLEDATA pHMHandleData; 298 298 BOOL ret; 299 ULONG ulBytesRead ;299 ULONG ulBytesRead, len; 300 300 301 301 pHMHandleData = HMQueryHandleData(lpRequest->hHandle); … … 317 317 #endif 318 318 319 ret = OSLibDosRead(pHMHandleData->hHMHandle, (LPVOID)lpRequest->lpBuffer, lpRequest->nNumberOfBytes, 320 &ulBytesRead); 319 ret = OSLibDosRead(pHMHandleData->hHMHandle, (LPVOID)lpRequest->lpBuffer, lpRequest->nNumberOfBytes, &ulBytesRead); 321 320 322 321 *lpdwResult = (ret) ? ulBytesRead : 0; … … 327 326 } 328 327 else { 329 //testestestest 328 #ifdef DEBUG 330 329 dprintf2(("%d Bytes read:", ulBytesRead)); 331 for(int i=0;i< ulBytesRead;i++) {330 for(int i=0;i<min(ulBytesRead, 16);i++) { 332 331 dprintf2(("%x %c", ((char *)lpRequest->lpBuffer)[i], ((char *)lpRequest->lpBuffer)[i])); 333 332 } 334 //testestestset 333 #endif 335 334 } 336 335 return GetLastError(); … … 352 351 } 353 352 354 //testestestest 353 #ifdef DEBUG 355 354 dprintf2(("Bytes to write:")); 356 for(int i=0;i< lpRequest->nNumberOfBytes;i++) {355 for(int i=0;i<min(lpRequest->nNumberOfBytes, 16);i++) { 357 356 dprintf2(("%x %c", ((char *)lpRequest->lpBuffer)[i], ((char *)lpRequest->lpBuffer)[i])); 358 357 } 359 //testestestset 358 #endif 360 359 361 360 ret = OSLibDosWrite(pHMHandleData->hHMHandle, (LPVOID)lpRequest->lpBuffer, lpRequest->nNumberOfBytes, … … 593 592 dprintf(("!ERROR!: ReadFile failed with rc %d", GetLastError())); 594 593 } 594 #ifdef DEBUG 595 595 else { 596 //testestestest597 596 dprintf2(("%d Bytes read:", ulBytesRead)); 598 for(int i=0;i< ulBytesRead;i++) {597 for(int i=0;i<min(ulBytesRead, 16);i++) { 599 598 dprintf2(("%x %c", ((char *)lpBuffer)[i], ((char *)lpBuffer)[i])); 600 599 } 601 //testestestset602 } 600 } 601 #endif 603 602 return ret; 604 603 } -
trunk/src/kernel32/overlappedio.cpp
r8638 r8644 1 /* $Id: overlappedio.cpp,v 1.1 5 2002-06-10 17:46:53 sandervl Exp $ */1 /* $Id: overlappedio.cpp,v 1.16 2002-06-11 12:51:43 sandervl Exp $ */ 2 2 3 3 /* … … 154 154 OverlappedIOHandler *lpOverlappedObj; 155 155 156 if(threadparam == NULL ) {156 if(threadparam == NULL || threadparam->lpOverlappedObj == NULL) { 157 157 DebugInt3(); 158 158 return 0; … … 222 222 pending[index] = lpRequest->next; 223 223 224 //add to inprocess list224 //add to the head of process list 225 225 lpRequest->next = pending[ASYNC_INDEX_BUSY]; 226 226 pending[ASYNC_INDEX_BUSY] = lpRequest; … … 230 230 hHandle = lpRequest->hHandle; 231 231 232 #ifdef DEBUG 233 switch(lpRequest->dwAsyncType) { 234 case ASYNCIO_READ: 235 case ASYNCIO_WRITE: 236 case ASYNCIO_POLL: 237 break; 238 default: 239 DebugInt3(); 240 break; 241 } 242 #endif 232 243 switch(dwOperation) { 233 244 case ASYNCIO_READ: … … 298 309 } 299 310 //remove from in-process list and delete async request object 300 findAndRemoveRequest(ASYNC_INDEX_BUSY, hHandle);311 removeRequest(ASYNC_INDEX_BUSY, lpRequest); 301 312 delete lpRequest; 302 313 } //while(TRUE) … … 346 357 else index = ASYNC_INDEX_WRITE; 347 358 348 ::EnterCriticalSection(&critsect); 349 if(pending[index]) { 350 current = pending[index]; 351 while(current->next) { 352 current = current->next; 353 } 354 current->next = lpRequest; 355 } 356 else pending[index] = lpRequest; 357 ::LeaveCriticalSection(&critsect); 359 addRequest(index, lpRequest); 358 360 359 361 lpOverlapped->Internal = STATUS_PENDING; … … 404 406 lpRequest->next = NULL; 405 407 406 ::EnterCriticalSection(&critsect); 407 if(pending[ASYNC_INDEX_READ]) { 408 current = pending[ASYNC_INDEX_READ]; 409 while(current->next) { 410 current = current->next; 411 } 412 current->next = lpRequest; 413 } 414 else pending[ASYNC_INDEX_READ] = lpRequest; 415 ::LeaveCriticalSection(&critsect); 408 addRequest(ASYNC_INDEX_READ, lpRequest); 416 409 417 410 lpOverlapped->Internal = STATUS_PENDING; … … 490 483 } 491 484 492 ::EnterCriticalSection(&critsect); 493 if(pending[ASYNC_INDEX_POLL]) { 494 current = pending[ASYNC_INDEX_READ]; 495 while(current->next) { 496 current = current->next; 497 } 498 current->next = lpRequest; 499 } 500 else pending[ASYNC_INDEX_POLL] = lpRequest; 501 ::LeaveCriticalSection(&critsect); 485 addRequest(ASYNC_INDEX_POLL, lpRequest); 502 486 503 487 //wake up async thread … … 584 568 //****************************************************************************** 585 569 //****************************************************************************** 586 570 void OverlappedIOHandler::addRequest(int index, LPASYNCIOREQUEST lpRequest) 571 { 572 LPASYNCIOREQUEST current; 573 574 ::EnterCriticalSection(&critsect); 575 if(pending[index]) { 576 current = pending[index]; 577 while(current->next) { 578 current = current->next; 579 } 580 current->next = lpRequest; 581 } 582 else pending[index] = lpRequest; 583 ::LeaveCriticalSection(&critsect); 584 } 585 //****************************************************************************** 586 //****************************************************************************** 587 void OverlappedIOHandler::removeRequest(int index, LPASYNCIOREQUEST lpRequest) 588 { 589 LPASYNCIOREQUEST current; 590 591 ::EnterCriticalSection(&critsect); 592 if(pending[index]) { 593 if(pending[index] == lpRequest) { 594 pending[index] = lpRequest->next; 595 } 596 else { 597 current = pending[index]; 598 while(current->next && current->next != lpRequest) { 599 current = current->next; 600 } 601 if(current->next) { 602 current->next = lpRequest->next; 603 } 604 else { 605 dprintf(("!ERROR!: request %x not found!!!!!!", lpRequest)); 606 DebugInt3(); 607 } 608 } 609 } 610 //else removed from list by cancelio 611 ::LeaveCriticalSection(&critsect); 612 } 613 //****************************************************************************** 614 //****************************************************************************** 615
Note:
See TracChangeset
for help on using the changeset viewer.