2 * msvcrt.dll misc functions
4 * Copyright 2000 Jon Griffiths
9 DEFAULT_DEBUG_CHANNEL(msvcrt);
11 typedef int (__cdecl *MSVCRT_comp_func)(const void*, const void*);
13 /*********************************************************************
16 void __cdecl MSVCRT__beep( unsigned int freq, unsigned int duration)
18 TRACE(":Freq %d, Duration %d\n",freq,duration);
22 extern int rand(void);
24 /*********************************************************************
27 int __cdecl MSVCRT_rand()
29 return (rand() & 0x7fff);
32 /*********************************************************************
35 void __cdecl MSVCRT__sleep(unsigned long timeout)
37 TRACE("MSVCRT__sleep for %ld milliseconds\n",timeout);
38 Sleep((timeout)?timeout:1);
41 /*********************************************************************
44 void* __cdecl MSVCRT__lfind(const void * match, const void * start,
45 unsigned int * array_size,unsigned int elem_size, MSVCRT_comp_func cf)
47 unsigned int size = *array_size;
51 if (cf(match, start) == 0)
52 return (void *)start; /* found */
58 /*********************************************************************
61 void * __cdecl MSVCRT__lsearch(const void * match,void * start,
62 unsigned int * array_size,unsigned int elem_size, MSVCRT_comp_func cf)
64 unsigned int size = *array_size;
68 if (cf(match, start) == 0)
69 return start; /* found */
73 /* not found, add to end */
74 memcpy(start, match, elem_size);
79 /*********************************************************************
82 void __cdecl MSVCRT__chkesp(void)