Compare commits

...

1376 Commits

Author SHA1 Message Date
Giannis Adamopoulos
32267fa846 really fix the branch now
svn path=/branches/Tree-restructure-test/; revision=49097
2010-10-10 14:49:45 +00:00
Giannis Adamopoulos
2217f465c0 attempt to fix the branch
svn path=/branches/Tree-restructure-test/; revision=49095
2010-10-10 14:31:24 +00:00
Giannis Adamopoulos
96b27cdbf1 Sync to trunk (2/2)
Add crt, ndk, ddk, and dxsdk
Remove from build mingw
Fix generating buildno.h

svn path=/branches/Tree-restructure-test/; revision=49093
2010-10-10 14:08:28 +00:00
Giannis Adamopoulos
e614394f89 Remove empty folders
Attempt to sync to trunk(1/2)

svn path=/branches/Tree-restructure-test/; revision=49092
2010-10-10 13:43:06 +00:00
Sir Richard
ee353ad690 [NTOS]: Go ahead and now fill out the OriginalPte field for PFNs initialized with MiInitializePfn(ForOtherProcess). They should only belong to ARM3 so they'll never have SwapEntry/RMAP associated with them. This functionality is important for future Prototype PTE support, among other things, as it lets us get the original PTE value written for a given PFN entry.
svn path=/trunk/; revision=48976
2010-10-04 18:22:50 +00:00
James Tabor
251be92abf [PSDK] - Add more track popup menu types.
svn path=/trunk/; revision=48975
2010-10-04 15:41:25 +00:00
James Tabor
aea07215a8 [Win32k]
- Fixed ValidateTimerCallback, always returning true and just spinning in the loop.
- Add one more process information flag with a point type and capturing the hit test in desktop structure.

svn path=/trunk/; revision=48970
2010-10-03 19:18:19 +00:00
Cameron Gutman
e14624d8ca [NDIS]
- Disable timer queuing code (hackfix for various network driver failures)
- Also needs to be merged into 0.3.12

svn path=/trunk/; revision=48968
2010-10-03 15:18:57 +00:00
Sir Richard
b01fc3d9a7 [NTOS]: Move all the Nt*Section API interfaces into ARM3 and rewrite most of the code to perform the same parameter validation and input checks as Windows does. Support all protection masks. Use correct section object access mask. Use appropriate SEH where needed. Pass 0-initialized local instead of NULL when needed. Don't assume certain parameters are OPTIONAL when they are not. Don't return SEH failures at the end of the system call, the kernel usually returns the result of the system call proper. Call DbgkMapViewOfSection in scenarios where it would not have gotten called before. Protect against certain kinds of kernel-mode access from user-mode.
[NTOS]: Move unimplemented Mm*Section APIs into ARM3 as well.

svn path=/trunk/; revision=48959
2010-10-02 02:14:39 +00:00
Sir Richard
706c5f3899 [PSDK]: Add missing SEC_XXX definitions for Server 2003 (Vista ones still missing).
[KERNEL32]: NtCreateSection should not be called with merely SEC_FILE: this says nothing about what kind of operation should be done (a commit, a reserve, etc?). Use SEC_COMMIT instead to specify correct operation. This works in ReactOS as of now, but would've failed after the NtSection* API rewrite.
[KERNEL32]: CreateFileMappingW should also accept/allow SEC_LARGE_PAGES, even if we don't suppport it yet.

svn path=/trunk/; revision=48958
2010-10-02 01:12:53 +00:00
Matthias Kupfer
93a1ceb834 Yugoslavia no longer exists for some time, replaced by Serbia as successor of country code (phone)
svn path=/trunk/; revision=48955
2010-10-01 19:54:27 +00:00
Johannes Anderwald
a53b8966ba [VIDEOPRT]
- Add sanity checks
- Implement VideoPortGetCommonBuffer, VideoPortLockPages


See issue #5629 for more details.

svn path=/trunk/; revision=48954
2010-10-01 17:43:03 +00:00
Jérôme Gardou
2374c7cb8d [XCOPY]
- Fix compilation with msvc
1. Someone should send this to wine (this is NOT lazyness)
2. Someone should tell mingw dev about http://msdn.microsoft.com/en-us/library/aa381050%28v=VS.85%29.aspx

svn path=/trunk/; revision=48948
2010-09-30 21:45:36 +00:00
Daniel Reimer
1a753c8708 Anti Oracle Movement has begun. Adding go-oo and LibreOffice to rapps.
svn path=/trunk/; revision=48943
2010-09-30 18:47:32 +00:00
Jérôme Gardou
ffeeddd5ee [DOSKEY]
- Fix compilation with msvc by GetProcAddress'ing undocumented functions
  - TCHAR -> WCHAR in the process

svn path=/trunk/; revision=48942
2010-09-30 18:45:58 +00:00
Sir Richard
efefc97901 [NTOS]: This is why you shouldn't let Antoine Dodson commit code.
svn path=/trunk/; revision=48941
2010-09-30 14:48:03 +00:00
Sir Richard
febd117a3b [NTOS]: He's climbing in yo PFN database, he snatching yo pages up, tryin to page em so y'all need to hide your pool hide your cache, and hide your working set cuz they grabbin' all the pages out there. We gonna page you, we gonna page you, so you can run and fault on that, run and fault on that, home boy, homeboy, home homeboy.
Enable ARM3 Paged Pool and remove all related deprecated code. Install tested on several VMs, it might cause new regressions. Let's fix them before 0.3.13 instead of reverting.

svn path=/trunk/; revision=48940
2010-09-30 04:40:31 +00:00
Sir Richard
40ba0f9329 [NTOS]: Use SYSTEM_PD_SIZE instead of assuming that this is PAGE_SIZE, since this is not the case on (future) ARM and (current) AMD64 ports.
[NTOS]: Remove some magic numbers in the pool code, using PTE_COUNT, MiAddressToPde, when needed. Also, the expansion code uses PDEs, not PTEs, so differentiate this, because on some systems (ARM), there are different structures for both.
[NTOS]: Use MI_WRITE_INVALID_PTE.
ARM3 paged pool now works, the expansion bug has been fixed (and the code is more portable). Expect to see it gradually enabled soon.

svn path=/trunk/; revision=48939
2010-09-30 03:26:13 +00:00
Sir Richard
39ab07fe2a [NTOS]: MiSetConsumer no longer achieves anything. Remove it.
svn path=/trunk/; revision=48938
2010-09-30 03:21:02 +00:00
Sir Richard
eaff9c1e8c [NTOS]: Add definition for size of a page directory, and size of all page directories required per process (some architectures have more than one page directory per process/address space).
svn path=/trunk/; revision=48937
2010-09-30 03:18:44 +00:00
Sir Richard
80d5d95d72 [NTOS]: Fix a bug in MiRemoveAnyPage: it was always checking the colored zero page list, instead of checking the colored free page list the second time around.
svn path=/trunk/; revision=48936
2010-09-30 03:17:14 +00:00
Pierre Schweitzer
a14c76d2c8 [PSDK]
Fixed build

svn path=/trunk/; revision=48935
2010-09-29 22:54:00 +00:00
Aleksey Bragin
24e16c3ff8 [REGE[REGEDIT]
- Katayama Hirofumi: Don't leak open handles to keys.
- Katayama Hirofumi: Misc code changes/ cleanup.
See issue #5547 for more details.

svn path=/trunk/; revision=48934
2010-09-29 21:52:16 +00:00
Aleksey Bragin
26adfda6bd [REGEDIT]
- Katayama Hirofumi: Unicodify regedit, add support for import/export of v5 reg files. Based on Wine regedit.

svn path=/trunk/; revision=48933
2010-09-29 21:43:39 +00:00
Pierre Schweitzer
219137196e [KMTEST]
Added a small testcase for FsRtlIsNameInExpression(). It's quite relevant for daily and simple use of the function. It shouldn't fail on ReactOS given our current implementation.

svn path=/trunk/; revision=48932
2010-09-29 21:42:11 +00:00
Aleksey Bragin
5ea7ca5562 PSDK
- Edison Henrique Andreassy <ehasis@hotmail.com>: Add FILEMUIINFO definition.
See issue #5640 for more details.

svn path=/trunk/; revision=48931
2010-09-29 21:32:56 +00:00
James Tabor
0922c986a4 [Win32k]
- Return the correct complexity, pass all user32 wine test_winregion tests.

svn path=/trunk/; revision=48930
2010-09-29 05:23:15 +00:00
James Tabor
658175b3a0 [Win32k]
- Fix future wine sync user32 win test for get process default layout with null parameter.

svn path=/trunk/; revision=48929
2010-09-29 02:29:33 +00:00
Cameron Gutman
be6788e54b [ACPI]
- Fix ACPI warnings
- Based on a patch by Love Nystrom

svn path=/trunk/; revision=48928
2010-09-29 02:16:18 +00:00
Sir Richard
14f8621042 [NTOS]: Add MiRemoveZeroPageSafe helper function, when a zero page is required, but the inline zeroing of MiRemoveZeroPage is not. This function will only try grabbing a zero page if one exists, otherwise a free page will be grabbed and zeroed with custom code of the caller's choosing.
[NTOS]: Add concept of process color and system color. Compute correct color to use whenever requesting a page.
[NTOS]: Uncondtionally enable the color code when inserting/removing pages.
For now, when requesting a page, colors are still ignored, and the global PFN lists are scanned instead. If there are no regressions, we are one patch away from that.

svn path=/trunk/; revision=48927
2010-09-29 01:10:28 +00:00
Sir Richard
71e8fc824b [NTOS]: Fix straggling bugs in color table algorithms.
[NTOS]: Enable color tables! Right now pages are merely entering and exiting the tables, the tables themselves are never used for allocations. This will change with further commits.

svn path=/trunk/; revision=48926
2010-09-29 00:13:09 +00:00
Sir Richard
f41dde713f [NTOS]: Write missing color code in certain PFN functions, and fix existing code where needed. Add some debugging. For now, turned off until testing succeeds.
[NTOS]: Redocument which MMPFN fields are violated by ReactOS-internal values. This has gotten much better than before.

svn path=/trunk/; revision=48925
2010-09-28 22:41:46 +00:00
Amine Khaldi
119639a212 [FONTS]
- Update RedHat Liberation Fonts to 1.06
- Update Tahoma Fonts To Wine HEAD
- Update DejaVu Fonts Documentation To 2.31
See issue #5632,5633,5634 for more details.

svn path=/trunk/; revision=48924
2010-09-28 17:19:52 +00:00
Amine Khaldi
1e65804aea [USETUP]
- Update Estonian translation by anthrax11.

See issue #5625 for more details.

svn path=/trunk/; revision=48923
2010-09-28 17:12:46 +00:00
Sir Richard
05d3392da9 [NTOS]: Switch to using an ARM3, much more correct MmZeroPageThread. Stub support for discarding sections and listening to the Power Manager Idle Timer.
[NTOS]: Use a synchronization (auto-reset) instead of notification event for the zero page thread, this way we don't have to reset it manually and query its state. Instead, a boolean MmZeroingPageThreadActive is checked instead.
[NTOS]: Once we switch to colored lists, major improvements can be done for speed.

svn path=/trunk/; revision=48922
2010-09-28 16:47:25 +00:00
Sir Richard
6ef328578c [NTOS]: The RMAP entry only has a valid process if the address is in user-space, otherwise process is NULL. Only attempt to acquire the process rundown lock if a process actually exists. Fixes crashes caused by 48905.
svn path=/trunk/; revision=48921
2010-09-28 16:44:18 +00:00
Sir Richard
5b9cd7fcae [NTOS]: Zeroed pages should go at the front, not the back of the zero list. Going to the back is a special boot-only case on MP, which isn't supported. Implement zero-only version of MiInsertPageInList, remove MiInsertZeroPageAtBack.
[NTOS]: Remove many other deprecated functions. Physical memory consistency should now be higher than in the past.

svn path=/trunk/; revision=48919
2010-09-28 14:38:30 +00:00
Sir Richard
354ad6b9eb [NTOS]: One last fix to the zero page thread before we move to ARM3: use MiRemoveAnyPage instead of dangerous MiRemoveHeadList. The code works on the assumption (validated by Windows through a bug check) that MiRemoveAnyPage always returns the first free page, and we also manually grab the first free page, and compare this is true. Nice way to detect PFN database corruption.
[NTOS]: Fix MiInsertZeroAtBack to increment the MmAvailablePage count, since MiRemoveAnyPage decrements it (MiRemoveHeadList did not).

svn path=/trunk/; revision=48918
2010-09-28 14:29:37 +00:00
Aleksey Bragin
66ff3d5774 [KERNEL32]
- Igor Paliychuk: Fix properly showing genitive names from NLS data by applying a missed Wine sync.
See issue #5556 for more details.

svn path=/trunk/; revision=48917
2010-09-28 14:24:17 +00:00
Amine Khaldi
a6480c90d3 [USETUP]
- Update Ukrainian translation by Igor Paliychuk.
See issue #5536 5540 5604 5614 5617 for more details.

svn path=/trunk/; revision=48915
2010-09-28 13:39:57 +00:00
Kamil Hornicek
9856680c43 [KERNEL32]
Winnls.h can be included now.

svn path=/trunk/; revision=48913
2010-09-28 00:02:05 +00:00
Sir Richard
f269313793 - Remove MiZeroPage, use MiZeroPhysicalPage instead. They work pretty much the same except the needless raise to DISPATCH_LEVEL.
- Get rid of the messed up MiMapPageToZeroInHyperSpace which was hacking into MiMapPagesToZeroInHyperSpace. Now MiMapPagesToZeroInHyperSpace is properly implemented to use chained PFNs, and the MmZeroPageThread code has been modified to correctly use the new mechanism.
- Zero page mapping now happens at PASSIVE trough MiMapPAgesToZeroInHyperSpace, not DISPATCH anymore.
- More fixes are coming to remove the remaining MiRemoveHeadList and rewrite the zero page loop. Should fix more possible corruptions.

svn path=/trunk/; revision=48912
2010-09-27 21:58:54 +00:00
Sir Richard
df34e334f0 [NTOS]: Adding colored page lists means we need to start using the OriginalPte field as a forward/back link. This is shared with AweReferenceCount, which ReactOS uses as the RMAP list head. However, RMAPped pages shoudl never be free/zero, and non-free-zero pages will never have a color backlink in OriginalPte, so it should theoretically be safe to do this. However, it's possible for the RMAP "get" function to be called on a free/zero page (which would normally return NULL), but with color chaining enabled, the "get" function would misinterpret the backlink as an RMAP entry. Therefore, we overload the ParityError bit to signify "there is an RMAP". The get/set functions now handle this, and the color linkage will ASSERT this later. This way, a colorlink with ParityError == FALSE is not treated as an rmap list head.
svn path=/trunk/; revision=48910
2010-09-27 17:36:54 +00:00
Sir Richard
05ce063ebc [NTOS]: Don't use dangerous MiRemoveHeadList in MDL page allocation, use MiRemoveAnyPage instead.
[NTOS]: Don't repurpose pages from the zero/free page list without actually unlinking the page first! This should fix even more corruptions.

svn path=/trunk/; revision=48909
2010-09-27 17:09:33 +00:00
Sir Richard
f5f6cee1d0 [NTOS]: Stop using MiInsertInListTail and MiRemoveHeadList in the deprecated ReactOS page functions. Those two functions do not adequately support the semantis needed for page insertion/removal and should've never been used. MmAllocPage now uses MiRemoveAny/ZeroPage, and MmDereferencePage uses MiInsertPageInFreeList. Should help with some corruptions. More is coming.
svn path=/trunk/; revision=48908
2010-09-27 16:00:24 +00:00
Giannis Adamopoulos
3e70fced07 [user32]
- Remove the last reactos-only export from user32 (PrivateCsrssManualGuiCheck)

[win32csr]
- Move PrivateCsrssManualGuiCheck from user32 to win32csr

svn path=/trunk/; revision=48907
2010-09-27 14:31:13 +00:00
Michael Martin
f9692ba22c [ntoskrnl/mm]
- Acquire rundown protection on process to make sure it is not being terminated and before attempting to do anything with the process. Fixed a rare case of PspDeleteProcess being called twice for a process, resulting in bugcheck.


svn path=/trunk/; revision=48905
2010-09-27 08:46:02 +00:00
James Tabor
e4ec568733 [Win32k]
- Implement win32k support functions for Get and Set process default layout.
- Due to changes with wine it will be difficult to sync when RTL support is being added to ComCtl32.

svn path=/trunk/; revision=48904
2010-09-27 02:46:16 +00:00
Sir Richard
de914c19e1 [DDK]: Add misisng MmLockPagableCodeSection.
svn path=/trunk/; revision=48903
2010-09-26 15:01:37 +00:00
Eric Kohl
db53bf24cb [NTOSKRNL]
Implement NtQueryOpenSubKeys.

svn path=/trunk/; revision=48902
2010-09-26 11:37:40 +00:00
Matthias Kupfer
c23c9c81ca disable some locale IDs because they are not supported yet
- 417 Rhaeto-Romanic
- 445 Bengali (India)
or still unknown
- 48f
- 490
this fixes multiple entries (see bug #5636)

svn path=/trunk/; revision=48898
2010-09-25 23:20:23 +00:00
Eric Kohl
1f2f04ed9b [NTOSKRNL]
IoRegisterPlugPlayNotification: Do not fail if no Interface can be found for the given GUID. Just do not call the Callback-Routine in this case. The Interface could be created later.

svn path=/trunk/; revision=48896
2010-09-25 21:49:15 +00:00
Pierre Schweitzer
d695e74a70 [RTL]
Fixed a really stupid (and old) bug in RtlComputeCrc32():
First parameter is initial CRC32 checksum. And it's complete and not partial, thus it needs to be an ULONG and not an USHORT.
This fixes CRC32 checksum computation with initial checksum (tested again Windows 2003 & Seven).

svn path=/trunk/; revision=48895
2010-09-25 21:20:54 +00:00
Amine Khaldi
ced22a087c [PSDK]
- Add missing header's header.

svn path=/trunk/; revision=48894
2010-09-25 20:47:15 +00:00
Christoph von Wittich
355ac9b9dc [bzip2]
update bzip2 library to 2.06

svn path=/trunk/; revision=48892
2010-09-25 20:28:00 +00:00
Jérôme Gardou
cb3ae7dca0 [WIN32K]
- clean up EXLATEOBJ before error path in NtGdiBitBlt

svn path=/trunk/; revision=48891
2010-09-25 19:53:43 +00:00
Matthias Kupfer
cfb984e8bb one more fix (on request of Pierre S.)
svn path=/trunk/; revision=48888
2010-09-25 19:24:03 +00:00
Matthias Kupfer
2a1e1c7eff add missing close for handle
svn path=/trunk/; revision=48886
2010-09-25 19:07:37 +00:00
Jérôme Gardou
6d6fd14277 [SOLITAIRE]
- do not include already included file in rc files

svn path=/trunk/; revision=48884
2010-09-25 18:44:54 +00:00
Matthias Kupfer
0b903df4a7 fix GeoID bug (forgotten \0)
svn path=/trunk/; revision=48883
2010-09-25 18:24:57 +00:00
Giannis Adamopoulos
28b33bcfe7 [win32k]
- Cleanup UserSetCursorPos
- UserSetCursorPos: set the new position after sending WM_MOUSEMOVE message
now we pass all tests for SetCursorPos

svn path=/trunk/; revision=48879
2010-09-25 16:59:53 +00:00
Amine Khaldi
f6e6759404 [PSDK]
- Add CDROM_TOC_SESSION_DATA structure.
[DDK]
- Add missing min and max macros.

svn path=/trunk/; revision=48878
2010-09-25 15:51:42 +00:00
Amine Khaldi
fd0b03ddfd [PSDK]
- Add missing ntddmmc.h definitions.

svn path=/trunk/; revision=48877
2010-09-25 15:37:43 +00:00
Amine Khaldi
5360c03d98 [PSDK]
- Add some missing IOCTL_* definitions.

svn path=/trunk/; revision=48874
2010-09-25 14:45:03 +00:00
Amine Khaldi
610744f805 [DDK]
- Fix a typo and introduce some minor formatting changes.

svn path=/trunk/; revision=48868
2010-09-25 09:39:08 +00:00
Eric Kohl
6df63531e0 Fix build failure from r48863.
svn path=/trunk/; revision=48867
2010-09-25 07:53:07 +00:00
Eric Kohl
8d574b3e5a [HAL]
Implement HalStopProfileInterrupt and add required RTC register and flag definitions.

svn path=/trunk/; revision=48866
2010-09-25 07:22:40 +00:00
Sir Richard
d59da19b08 [PSDK/DDK]: Last couple of fixes to headers. Classpnp can compile (and link) now.
svn path=/trunk/; revision=48865
2010-09-25 05:46:31 +00:00
Sir Richard
c0e90cf2dd [PSDK/DDK]: Add more missing definitions. Fix classpnp.h.
svn path=/trunk/; revision=48864
2010-09-25 05:15:47 +00:00
Amine Khaldi
7c9e442a28 [PSDK]
- Add some missing structures in ioevent.h
[DDK]
- Add some more missing definitions.

svn path=/trunk/; revision=48863
2010-09-25 01:12:17 +00:00
Amine Khaldi
d7d6e5e9c3 [DDK]
- classpnp.h: Add FUNCTIONAL_DEVICE_EXTENSION, SET_FLAG, CLEAR_FLAG and TEST_FLAG

svn path=/trunk/; revision=48862
2010-09-25 00:51:30 +00:00
Amine Khaldi
d732208205 [DDK]
- Add missing classpnp.h

svn path=/trunk/; revision=48861
2010-09-24 23:42:30 +00:00
Sir Richard
0c7d1b1c8f [NTDLL]: Use LOCK instead of lock for SList assembly functions, this is a conditional such that on UP, "lock" instruction won't be generated.
[NTDLL]: Apply the special begin/fault/resume lablels to the user-mode SList functions. Access faults can happen there due to a bug in the Windows algorithm, and Mm will need to handle that.
[NTOS]: Lookup the special labels from above when initializing the System DLL. Only lookup INT2E vs SYSENTER on x86, other architectures don't need a stub.
[NTOS]: Bitmap resources start at index 1, not 0. Also make sure we don't go past the maximum IDB_ resource index for no reason, and check the size of the resource instead of assuming it's going to be one page.
[NMIDEBUG]: Fix and cleanup some code, and enable NMI support on the boot/install CD as well.

svn path=/trunk/; revision=48860
2010-09-24 17:02:13 +00:00
Michael Martin
2c5e05984a [ntoskrnl/ps]
- Revert r48857. The Process object is dereferenced when the Thread object is destroyed, so dont dereference it here.

svn path=/trunk/; revision=48859
2010-09-24 15:27:24 +00:00
Michael Martin
0059b61f9c [ntoskrnl/ps]
- Remove mistakenly committed ASSERTs that were used during my tests.

svn path=/trunk/; revision=48858
2010-09-24 10:23:01 +00:00
Michael Martin
b83eb0a472 [ntoskrnl/ps]
- PspCreateThread: If thread creation fails, dereference the Process object also to account for the reference taken at the beginning of the function.

svn path=/trunk/; revision=48857
2010-09-24 10:07:54 +00:00
Daniel Reimer
03a0d1dc88 Big rapps Update
svn path=/trunk/; revision=48855
2010-09-23 21:33:49 +00:00
Timo Kreuzer
ba0bf5862d [HAL]
Fix amd64 build

svn path=/trunk/; revision=48854
2010-09-23 20:22:12 +00:00
James Tabor
81730f239d [Win32k]
- Coding for PrintWindow support for bug 5609. This does not fix the export, which should be a direct call to win32k.

svn path=/trunk/; revision=48853
2010-09-23 17:51:10 +00:00
evb
29f98a6645 - Fix PciFindParentPciFdoExtension bug found by sir_richard "Early break would leave the lock held"
- Fix PciGetHackFlags for setup found by sir_richard "Setup currently doesn't have a correct registry"
- Fix DriverEntry for setup like PciGetHackFlags
- Fix DriverEntry PciOpenKey check found by sir_richard "PciOpenKey returns a BOOLEAN, not an NTSTATUS"
- Stop call PciGetAcpiTable found by sir_richard "PciGetAcpiTable is really broken, can lead to infinite loops, and also corrupts memory. We need to fix stefan's bugs"
- Implement not root FDO code in PciScanBus and support PCI_HACK_ONE_CHILD
- Implement multiple FDO exist code in PciAddDevice so PCI Bridge support now
- Implement PciAreBusNumbersConfigured for PCI Bridge support
- Hack FDO Start Device by sir_richard "The root FDO does send boot resources if PCIX is installed properly, this code will be needed"
- Do PCI_BUS_DRIVER_INTERNAL bugcheck by sir_richard "I have hacked KeBugCheckEx to ignore this for now, until PnP is fixed"
- Implement not root FDO code in PciInitializeArbiters
- Implement PciCacheLegacyDeviceRouting, PciFindPdoByLocation used by PciAssignSlotResources
- Make PciTranslateBusAddress do the stub work
- PciAssignSlotResources disabled because ReactOS not support IoAssignResources
- Implement PPBridge_ChangeResourceSettings
PCIX driver nearly working now.

svn path=/trunk/; revision=48851
2010-09-23 13:24:41 +00:00
Johannes Anderwald
10eb63f2df [KS]
- Simplify KsTopologyPropertyHandler by using KspReadMediaCategory helper
- Return correct status code in case of an overflow

svn path=/trunk/; revision=48850
2010-09-23 11:36:00 +00:00
Johannes Anderwald
cf358ed153 [I8042PRT]
- Fix potential buffer overflow

svn path=/trunk/; revision=48849
2010-09-23 11:32:34 +00:00
Amine Khaldi
9b07516436 - Bugs 5536, 5614, 5604, 5617 and 5540: Apply translation patches provided by Mario Kacmar, Marcelo Zamperetti, Igor Paliychuk, Paolo Devoti and seven_ro.
svn path=/trunk/; revision=48847
2010-09-22 19:29:20 +00:00
Sir Richard
409884a7ce [FREELDR]: Fix the last remaining build issue. Libgcc needs to be linked to provide umovsi/udivsi, etc (same fix as for setupldr).
svn path=/trunk/; revision=48846
2010-09-21 17:50:01 +00:00
Amine Khaldi
d09d10d12d [KERNEL32]
- Sylvain Petreolle: Fix debug channels for release builds.

svn path=/trunk/; revision=48845
2010-09-21 17:14:22 +00:00
Sir Richard
b60395bc25 [HAL]: Partly implement HalpAdjustPCIResourceList required for legacy HAL. No actual adjustment is done yet, since the Range package is not implemented.
[HAL]: Implement most of HalpGetISAFixedPCIIrq, other than the legacy PCI IRQ Routing Miniport callbacks, which aren't yet implemented by ReactOS.
The Windows PCI Bus Driver seems to work now.

svn path=/trunk/; revision=48844
2010-09-21 17:07:40 +00:00
Aleksey Bragin
7e91f6cbe7 - Update 3rd Party Files.txt To Current 3rd Party Releases.
See issue #5603 for more details.

svn path=/trunk/; revision=48843
2010-09-21 08:30:56 +00:00
Sir Richard
88e1640ef7 Patches to allow Windows PCI Bus Driver to start working somewhat (need to implement HalAdjustResourceList for PCI to make it go further):
[BOOTDATA]: Windows Bus Drivers/HAL/Kernel require Arbiter data in the registry placed by the installer, otherwise they will not load. Add this Arbiter data.
[NTOS]: Add support for KeyValueFullInformationAlign64, used by some Windows drivers (as a bonus, support Win64). PartialInformationAlign64 is a different beast -- warn when a driver attempts to use it, instead of silent failure.
[NTOS]: Export VfFailSystemBIOS and stub it.
[NTOS]: Warn when a driver fails to load due to a missing dependency and print the name and/or missing module, instead of silently failing.
[NTOS]: Due to a bug in the ReactOS PnP manager, Windows PCI Driver hits an internal pseudo-assert. Hack KeBugCheckEx to ignore this pseudo-assert and continue executing normally.

svn path=/trunk/; revision=48839
2010-09-21 05:34:05 +00:00
Cameron Gutman
12d05b7eb8 [TCPIP]
- Process the timer event directly from the DPC instead of queuing a work item then raising to DISPATCH_LEVEL later when acquiring a spin lock
- Optimize the spin lock operations in NBTimeout and IPDatagramReassemblyTimeout for being called at DISPATCH_LEVEL

svn path=/trunk/; revision=48833
2010-09-20 19:08:40 +00:00
Michael Martin
a5a6cf644d [usb/usbhub]
- WaitForUsbDeviceArrivalNotification: Dont use IoBuildDeviceIoControlRequest to create the IRP as we dont wait for the IRP to complete in the current thread. It must be built using IoAllocateIrp.
- DeviceArrivalCompletion: Allocate the WorkItem from NonPagedPool vice using one in the DeviceExtension. Free the Irp and return STATUS_MORE_PROCESSING_REQUIRED so the IO Manager doesnt try to do anything more with the now freed Irp.
- When selecting the Interface use the routines in USBD library now that they are implemented correctly.
- More fixes for passing the correct DeviceObject when calling QueryRootHub.


svn path=/trunk/; revision=48826
2010-09-20 06:55:54 +00:00
Sir Richard
56738210e7 [MISC]: Fix several compiler issues on my main build box. Some of the Unicode translations in kernel32 fail to compile, while other libraries don't build because old C library names (without the underscore) are used.
[SETUPLDR]: Unify the old setupldr settings with more recent freeldr ones. Also fixes missing _udiv/mod functions on my build.

svn path=/trunk/; revision=48825
2010-09-20 06:30:21 +00:00
Eric Kohl
9c6c2c7c45 [USETUP]
Add Brazilian portuguese USETUP localization patch by Edison Henrique Andreassy.


See issue #5313 for more details.

svn path=/trunk/; revision=48813
2010-09-19 12:46:54 +00:00
Aleksey Bragin
0dc63433f9 [DESK.CPL]
Katayama Hirofumi <katayama.hirofumi.mz@gmail.com>
- Renamed GLOBAL_DATA structures to DATA.
- Added real GLOBAL_DATA in background.c, that manages the background color.
- Resolved conflict of background colors in background.c and appearance.c.
- Fixed drawing the menu in draw.c.
See issue #5620 for more details.

svn path=/trunk/; revision=48812
2010-09-19 11:54:33 +00:00
Michael Martin
3a615a70fb [usb/usbd]
- Fix calculation bug in USBD_ParseDescriptors which caused descriptors to be skipped and all Parse functions to return bad information.
- USBD_CreateConfigurationRequestEx: Fix calculation for the size of the URB.
Dont copy the InterfaceList to the Urbs Interface member as they are not the same structures.  Instead loop through each interface and endpoint to get the data needed for the Interface member of URB.
- USBD_GetInterfaceLength: Add missing brackets for the FOR LOOP. The first descriptors length is part of the Length regardless of what it is.
If bDescriptorType of USB_INTERFACE_DESCRIPTOR_TYPE is reached a second time then break from the loop, as the length calculation is done.

svn path=/trunk/; revision=48810
2010-09-19 00:30:49 +00:00
Cameron Gutman
cf913565c0 [IP]
- Fix a reference leak when aborting a listen request

svn path=/trunk/; revision=48806
2010-09-18 15:50:56 +00:00
Aleksey Bragin
41106fa541 [NTOS]
- Add support for Cyrix CPUs by checking and applying a workaround for the Cyrix 6x COMA bug (description here: http://gwyn.tux.org/~balsa/linux/cyrix/p11.html).
See issue #5610 for more details.

svn path=/trunk/; revision=48801
2010-09-18 09:14:45 +00:00
Aleksey Bragin
becc9ed282 [SC]
- Roel Messiant: Fix a crash when running some operations in sc without providing arguments. Also, provide usage information for the control and unknown commands.
- Aleksey Bragin: Take Ged Murphy's comments into account and change pointer arithmetic to a convenient style.
See issue #5611 for more details.

svn path=/trunk/; revision=48800
2010-09-18 08:41:06 +00:00
Aleksey Bragin
2c10fb5d07 [OLE32]
- Sync to Wine-20100918.
See issue #5592 for more details.

svn path=/trunk/; revision=48795
2010-09-17 20:13:28 +00:00
Timo Kreuzer
2cc0f42e45 [SHELL32]
Johannes Anderwald:
- Partly revert 48786
- Use existing sLinkPath instead of own grown sCurFile
- Fixes 6 more winetest failures, 4 to go for shellink test

svn path=/trunk/; revision=48792
2010-09-17 19:00:12 +00:00
Amine Khaldi
c8d65c59a4 [SHELL32]
Johannes Anderwald:
- Improve parameter checks for IShellLinkA interface.
- Fix heap corruption when an invalid pointer is passed.
- Implement IPersistFile_fnGetCurFile.
- TODO: Add same checks to IShellLinkW interface and fix IShellLink[A|W]::GetPath / SetPath / SetIdList / GetIdList logic.

svn path=/trunk/; revision=48786
2010-09-17 10:26:17 +00:00
Timo Kreuzer
253e949e7a [WIN32K]
Fix a bug, where a failure to allocate the kernel mode WINDOW_OBJECT would cause a page fault, because the WND was still allocated, but never initialized, and Wnd->rpdesktop was then dereferenced to free the WND again.

svn path=/trunk/; revision=48785
2010-09-17 01:34:50 +00:00
Timo Kreuzer
30fad2a263 [NTOS]
- More fixes to VDM PUSH/POPF code: 
- When doing a 32bit push, don't store the flags 2 bytes off
- Recalculate HardwareEsp, by substracting the segment part, instead of truncating the flat pointer to 16 bit.

svn path=/trunk/; revision=48781
2010-09-16 19:21:20 +00:00
Sir Richard
cdebe5691a Patch by Anton Yarotsky:
[NTOSKRNL]: Fix support for non Headless scenarios as well.

svn path=/trunk/; revision=48780
2010-09-16 02:22:10 +00:00
Timo Kreuzer
c2e13c8c49 Fix arm build a bit.
svn path=/trunk/; revision=48779
2010-09-15 23:48:38 +00:00
Sir Richard
af197a47b2 Patch by Anton Yarotsky:
[NTOSKRNL]: Implement CmdPutString command, and add log message types. Kernel version/build, processor, and RAM, now appear on EMS screen (due to InbvDisplayString), as well as loaded drivers. Next steps are to support log entries and a flag to route debug output (a ReactOS-specific feature request).

svn path=/trunk/; revision=48778
2010-09-15 18:30:06 +00:00
Michael Martin
0b77725d6e [usb/usbehci]
- Change email address to one that actually works.

svn path=/trunk/; revision=48777
2010-09-15 13:16:59 +00:00
Amine Khaldi
61ae4ea31c [DDK]
- Define DECLSPEC_EXPORT when it's not already defined.

svn path=/trunk/; revision=48774
2010-09-15 09:03:57 +00:00
Sir Richard
b52bd79196 Patch by Anton Yarotsky:
[NTOSKRNL]: Implement basic Headless support in the kernel. Implement missing InbvPort routines based on WinLdrPort (using cportlib). Add header for Hdl. Terminal initializes now on COM2. Added misisng code to InbvDisplayString to also display on Headless Terminal (requires unimplemented HeadlessDispatch). Next steps are to implement the kernel log buffer, and HeadlessCmdPutString to see boot strings.

svn path=/trunk/; revision=48773
2010-09-15 07:46:28 +00:00
Sir Richard
c806e95592 Patch by Anton Yarotsky:
[FREELDR]: Fix Headless support.

svn path=/trunk/; revision=48772
2010-09-15 07:40:50 +00:00
Michael Martin
7a26c678b7 [usb/usbhub]
- On completion of SCE request, create and queue a workitem to handle:
Clearing the connection flag and reset the port. 
Create and initialize the USB device by calling the appropriate roothubs Direct Call Interface.
Create the device object, get the device descriptors and the serial and product strings of the USB device to be used for creating the deviceid and instanceid.
- Format code and misc changes.
- Together with the usbehci driver, ReactOS at least runs the device installation wizard with the correct device description.

svn path=/trunk/; revision=48771
2010-09-14 12:04:15 +00:00
Michael Martin
45bd4d8031 [usb/usbehci]
- Dont reset the port in the DPC after device is connected, the usbhub driver will do that later.
- Implement ResetPort and create a timer to call a DPC to coplete the SCE request.
- Dont queue all URBs and have seperate thread complete them as other URBs may still need to be completed.
Instead only queue the SCE request and complete it when a usb device is connected or reset.
- Implement RemoveURBRequest and fix bugs in URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE.
- For IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO dont return the FDO in Argument2 as no upper level driver should be communicating with the FDO of the roothub.
- Dont assign the usb device an address when initialized as the hub driver will do it later.

svn path=/trunk/; revision=48770
2010-09-14 09:46:28 +00:00
Sir Richard
ef0d280232 Patch by Anton Yarotsky:
[FREELDR]: Implement support for /redirect=comX (usebiossettings not yet supported) and /redirectbaudrate. Uses cportlib. Tested, serial output works and kernel reports "Headless support is not yet implemented". Future revisions should support ACPI SRT for PCI-based serial ports on server systems.

svn path=/trunk/; revision=48768
2010-09-13 20:36:49 +00:00
Amine Khaldi
1a554af4a0 [USETUP]
- Sylvain Petreolle: Improve debug prints for disk space check.

svn path=/trunk/; revision=48767
2010-09-13 17:25:00 +00:00
Amine Khaldi
9c827ade73 [USETUP]
- Christoph von Wittich: Add a debug print, and improve an existing one.

svn path=/trunk/; revision=48766
2010-09-13 16:34:15 +00:00
Eric Kohl
cab60ab876 [BATT]
Add missing 4th parameter to BatteryClassCoInstaller.

svn path=/trunk/; revision=48764
2010-09-13 11:48:59 +00:00
Cameron Gutman
b4473ff304 [DESK]
- "repair DragFullWindows setting"
- Patch by Matthias Kupfer

svn path=/trunk/; revision=48761
2010-09-12 20:10:27 +00:00
Sir Richard
903bb1c887 Likely fix for bug 5600:
[NTOS]: Using IsBadRead/CodePtr, it's possible for user-mode code to generate cases where we *think* this is an ARM3-managed piece of VA, which will always have a VAD (Since we only manage the PEB/TEB), but actually it's a bogus VA-looking address that is actually invalid. We didn't consider this case. We now implement the same code Windows normally would also handle, when the VA is bogus, and accept that no VAD might be found, so MM_NOACCESS is returned and thus an access violation sent to the caller. In the case of the IsBad...Ptr, this function would then return TRUE, as the caller expects.

svn path=/trunk/; revision=48759
2010-09-12 19:10:27 +00:00
Sir Richard
3f003e294e [NTOS]: Move the fix for pool corruption due to dangling MmProcessLinks pointer into its correct location. Thanks again to Martin for the fix.
svn path=/trunk/; revision=48758
2010-09-12 19:02:39 +00:00
Eric Kohl
46d89d3a50 Make Services.exe and Winlogon.exe wait for the LSA server to be up and running. Otherwise calls to any LSA function might fail.
Thanks to Roel Messiant for testing and analyzing the debug logs.

See issue #5497 for more details.

svn path=/trunk/; revision=48757
2010-09-12 16:29:43 +00:00
Amine Khaldi
2270e330b0 [PSDK]
- Properly guard d3d9types.h and d3dtypes.h against DIRECT3D_VERSION versions.

svn path=/trunk/; revision=48754
2010-09-12 14:51:32 +00:00
Aleksey Bragin
078476414c - Revert 48750, I was misinformed.
svn path=/trunk/; revision=48753
2010-09-12 12:14:46 +00:00
Cameron Gutman
804899ffc6 [NDIS]
- Fix timer queuing
- See issue #5461 for details

svn path=/trunk/; revision=48752
2010-09-12 11:57:55 +00:00
Aleksey Bragin
8fcb361453 [PCIX]
- Stefan Ginsberg: Fix a typo in the if expression.

svn path=/trunk/; revision=48751
2010-09-12 10:35:01 +00:00
Aleksey Bragin
5bb5788d76 [NTOS]
- Add CmRegistryMachineSystemName to the internal header file, needed for Pierre's further work.

svn path=/trunk/; revision=48750
2010-09-12 10:29:35 +00:00
Aleksey Bragin
526130ba91 [FREETYPE]
- Fix FT_Get_CID_Is_Internally_CID_Keyed export name to match source code.

svn path=/trunk/; revision=48749
2010-09-12 10:11:55 +00:00
Sir Richard
6575a83c33 - Fix the ChangeResourceSetting and the Reset configurator callback parameter names
- Part support for resource change with PciComputeNewCurrentSettings... full support for PciSetResources, PciUpdateHardware, PcipUpdateHardare
- IRP_MN_START_DEVICE for PDO (PciPdoIrpStartDevice) implement 
- PciNextPartialDescriptor, PciDebugPrintCmResList, PciDebugPrintPartialResource helpers implement
- Now full PDO support almost done, PCIX driver ready for test
- Thanks to cgoodman assert fix
- PnP forever recursion in enumerate, must fix to finish
- Goodbye sir_richard, nice to have you

svn path=/trunk/; revision=48748
2010-09-12 06:03:12 +00:00
Cameron Gutman
a0b7f0f4b9 [USETUP]
- Update the Polish translation
- Patch by Olaf Siejka

svn path=/trunk/; revision=48747
2010-09-12 00:47:07 +00:00
Aleksey Bragin
a14482e225 [WINLOGON]
- Fix comments copypasta.

svn path=/trunk/; revision=48746
2010-09-11 21:16:41 +00:00
Aleksey Bragin
a5c563dfdb [NTOS]
- Daniel Zimmermann: Fix POPF bugs in VDM mode, namely truncation of the stackpointer to 16 bit and setting proper flags in the trapframe eflags register. This fixes problems with videocards calling int 0x10 VESA BIOS extension.
See issue #5608 for more details.

svn path=/trunk/; revision=48745
2010-09-11 09:20:26 +00:00
Aleksey Bragin
b8cbac25c2 - Fix build, sorry.
svn path=/trunk/; revision=48744
2010-09-11 09:01:58 +00:00
Aleksey Bragin
c9888046ef [HAL]
- Don't include PCI IDs database into mini-HAL.

svn path=/trunk/; revision=48743
2010-09-10 21:57:46 +00:00
Eric Kohl
c3c0a62855 [DESK.CPL]
Fix client font in the advanced appearance dialog. Patch by Katayama Hirofumi.
See issue #5552 for more details.

svn path=/trunk/; revision=48742
2010-09-10 21:57:36 +00:00
Aleksey Bragin
9488b4aab6 [FORMATTING]
- Fix indentation.

svn path=/trunk/; revision=48741
2010-09-10 21:51:32 +00:00
Aleksey Bragin
2d246e918e [HAL]
- Add missing call to HalInitPnpDriver during I/O manager initialization. The HAL PnP driver was never getting initialized.
- Add HAL callback for HalInitPnpDriver. It's going to be needed in future for eVb's PCI driver to fully work (interrupt translation, among other things).

svn path=/trunk/; revision=48740
2010-09-10 21:46:13 +00:00
Aleksey Bragin
1a029a622d [NTOS]
- Fix several bugs in Inbv (busted locking code, useless variables, magic initializers).

svn path=/trunk/; revision=48739
2010-09-10 21:28:24 +00:00
Michael Martin
bd0767f9fd [ntoskrnl/io]
- Modify IopCreateDriver to accept the PLDR_DATA_TABLE_ENTRY instead of the DllBase and SizeOfImage from this structure.
- Set the DriverObject->DriverSection before calling the DriverEntry routine.
- If the DriverEntry routine fails then set the DriverObject->DriverSection back to NULL so that IopDeleteDriver doesnt attempt to unload the ModuleObject, after it was already unloaded by the caller.

svn path=/trunk/; revision=48738
2010-09-10 21:25:53 +00:00
Aleksey Bragin
0daaf9da75 [NTOS]
- Fix a code typo which led to a security issue when the XOR algorithm for the system cookie might actually yield zero. Now it's going to loop as long as the cookie is 0, attempting to generate a non-zero one.

svn path=/trunk/; revision=48737
2010-09-10 21:13:06 +00:00
Aleksey Bragin
9b12a8c1d7 [NDK]
- Remove deprecated KV86M structures and files.

svn path=/trunk/; revision=48736
2010-09-10 21:08:38 +00:00
Aleksey Bragin
1f4771d41b [NTOS]
- Fix a strange bug where we were only setting SharedUserData->TestRetInstruction conditionally only if lookup failed - it should be set on success. Also, bail out if the lookups failed.

svn path=/trunk/; revision=48735
2010-09-10 21:01:59 +00:00
Michael Martin
dee985f9c6 [ntoskrnl/io/pnpmgr]
- Fix incorrect POOL_TYPE allocation in IoInvalidateDeviceRelations. This function can be called at DISPATCH_LEVEL, which requires NonPagedPool POOL_TYPE.

svn path=/trunk/; revision=48734
2010-09-10 19:45:01 +00:00
Aleksey Bragin
1355a06e32 [NDK]
- Fix KiBugCheckData declaration.

svn path=/trunk/; revision=48733
2010-09-10 18:20:37 +00:00
Aleksey Bragin
0955523e4f [WIN32K]
- Giannis Adamopoulos: Only dereference a class if it's valid, should fix Heroes 3 crash.
See issue #5606 for more details.

svn path=/trunk/; revision=48732
2010-09-10 18:13:02 +00:00
Aleksey Bragin
cacc80ae3e [HAL]
- Stub support for future timer latency watchdog.
- Change older-style comments to standard ReactOS commenting style.

svn path=/trunk/; revision=48731
2010-09-10 13:15:51 +00:00
Aleksey Bragin
b84512b555 [NTOS]
- Rename KINTERRUPT_DISPATCH_CODES to DISPATCH_LENGTH, as it is in PSDK.
- Enhance NMI debug support.
- Change some comments to standard ReactOS commenting style.

svn path=/trunk/; revision=48730
2010-09-10 09:54:30 +00:00
Aleksey Bragin
7a9bd9ccea [KERNEL32]
- Fix release build, part 2. Further improvement to gDebugChannels would be to convert them to a DECLARE_DEBUG_CHANNEL-alike macro.

svn path=/trunk/; revision=48729
2010-09-10 09:04:25 +00:00
Aleksey Bragin
60bb233f46 - Fix typos in the description of serial port defines.
svn path=/trunk/; revision=48728
2010-09-10 08:30:13 +00:00
Sir Richard
c27087c0e6 Patch by Anton Yarotsky:
[CPORTLIB]: Implement Windows' Cp (ComPort) library. See Notes in C file. Not yet used. Based on MS Whitepaper: Building Hardware and Firmware to Complement Microsoft Windows Headless Operation.

svn path=/trunk/; revision=48727
2010-09-10 05:22:48 +00:00
Aleksey Bragin
228af0c797 [NTOS]
- Fix release build, leftover from 48692.

svn path=/trunk/; revision=48726
2010-09-09 21:06:13 +00:00
Michael Martin
322032192b [ntoskrnl/po]
- Fix typo.

svn path=/trunk/; revision=48725
2010-09-09 09:22:49 +00:00
Michael Martin
573715a9fe [ntoskrnl/po]
- When an IRP is freed in a Completion routine the return Status is STATUS_MORE_PROCESSING_REQUIRED to let IoCompleteRequest know not to do anything further with the IRP.

svn path=/trunk/; revision=48724
2010-09-08 21:30:40 +00:00
Eric Kohl
db5ca64e4e [SCSIPORT]
Implement RequestTimerCall-Notification. This is used by uniata.

svn path=/trunk/; revision=48723
2010-09-08 10:39:37 +00:00
Eric Kohl
3100fc8995 [USETUP]
Allocate a drive layout buffer that is large enough to keep a primary partition table (4 partition entries) plus 26 logical drives (2 partition entries each). Total 56 partition entries. This should be enough for everybody until we support GPT partition tables. ;-)
See issue #5270 for more details.

svn path=/trunk/; revision=48722
2010-09-07 15:21:06 +00:00
Eric Kohl
340a34cec4 Improvements to NtAdjustPrivilegesToken part 4 (last one):
- SEH-protect all code that writes to PreviousState as it cannot be captured.
- Add a missing ObDereferenceObject and SeReleaseLuidAndAttributesArray.

svn path=/trunk/; revision=48721
2010-09-07 15:08:29 +00:00
Michael Martin
e851b3ba21 [usb/usbhub]
- Add function for dumping the Device and Configuration Descriptors.
- Implement WaitForUsbDeviceArrivalNotification, used to send a URB transaction to the Status Change Endpoint of the RootHubs pdo. The RootHubs pdo will queue this request until a new usb device connects.
- Call above function at the end of UsbhubFdoQueryBusRelations, which will be called by the pnp manager after the hub driver creates a new child device.
- Change the URB to be allocated from the pool at IRP_MN_START_DEVICE.
- Call QueryRootHub with the RootHub Pdo and not the hub drivers DeviceObject.
- Implement selecting a configuration for the RootHub.

svn path=/trunk/; revision=48719
2010-09-07 11:44:03 +00:00
Michael Martin
b43cf6c771 [USETUP]
- Translation updates by Pierre Schweitzer.

svn path=/trunk/; revision=48718
2010-09-07 09:40:53 +00:00
Eric Kohl
6153f47739 Improvements to NtAdjustPrivilegesToken part 3:
- Simplify the privilege modification code.

svn path=/trunk/; revision=48717
2010-09-07 09:32:30 +00:00
Sir Richard
b96cb710f4 [GDI32]: Don't destroy the heap when calling GetSystemPaletteEntries. Note to whoever wrote "//make this work": (&array[x]) is defintely not equal to (&array + x). This is why we don't use pointers-to-arrays, among other reasons.
[GDI32]: Reformat GetSystemPaletteEntries away from grotesque 5-space identation (who does that?).
[GDI32]: Optimize GetSystemPaletteEntries by not zeroing over fields that get overwritten anyway.
[GDI32]: Simplify loop control, remove not-needed local variable in GetSystemPaletteEntries.

svn path=/trunk/; revision=48716
2010-09-07 07:50:51 +00:00
Sir Richard
65fc01dc92 [PSDK]: Get rid of unused variable.
svn path=/trunk/; revision=48715
2010-09-07 05:22:13 +00:00
Cameron Gutman
70e3baab3e [FREELOADER]
- Don't zero the target of an uninitialized pointer
- Thanks to arty for finding the issue

svn path=/trunk/; revision=48713
2010-09-07 01:31:24 +00:00
Sir Richard
b0e67ed0fb [WIN32K]: Fix large amount of set-but-unused variables. Most of these seemed to be old/unfinished code, however in IntGdiPaintRgn an actual bug seems to have been found.
[WIN32K]: Make IntGdiPaintRgn return the status of the operation, not always TRUE.

svn path=/trunk/; revision=48712
2010-09-06 23:55:53 +00:00
Timo Kreuzer
b687dc9462 [USETUP]
- When creating fresh partitions, set the HiddenSectors mamber. Fixes fat32 installation.

svn path=/trunk/; revision=48711
2010-09-06 17:02:47 +00:00
Eric Kohl
9ba0d09d90 Improvements to NtAdjustPrivilegesToken part 2:
- Check for invalid parameter combinations.
- Count privileges that will be changed before changing them.
- Return required buffer size.
- Fail if the provided buffer is too small.
See issue #5497 for more details.

svn path=/trunk/; revision=48710
2010-09-06 15:26:12 +00:00
Eric Kohl
1e34ad4d19 Translated new boot loader options and fixed a typo.
svn path=/trunk/; revision=48709
2010-09-06 10:24:50 +00:00
Eric Kohl
fd61ebc8bb fdc.inf: Fix a typo in the class guid.
hdc.inf: Add missing manufacturer string.

svn path=/trunk/; revision=48708
2010-09-06 09:53:36 +00:00
Eric Kohl
b9159984e7 NtAdjustPrivilegesToken: Probe and capture parameters before use.
See issue #5497 for more details.

svn path=/trunk/; revision=48707
2010-09-06 09:51:46 +00:00
Timo Kreuzer
3995cce1ba [USETUP]
The VBR (volume boot sector) contains a structure called BPB (bios parameter block) that describes the disk and the partition. The HiddenSectors member contains the number of the first sector of the partition. This is used by the VBR code to load the secondary sector containing additional boot code that is located at secor 14 relative to the partition start. Previously we were copying the BPB (plus additionally the OemName, which makes no sense) from the old VBR. Now Linux is a bit lame and doesn't put the correct value into the HiddenSectors field. Instead it sets it to the number of sectors per track which seems to be the default value. When now the linux partition manager decides to do a non standard partitioning, aligning the partition to 0x800, then the VBR fails to load it's 2nd sector. Fix this by correcting the value in the BPB with the value from the partition info.

See issue #2733 for more details.

svn path=/trunk/; revision=48706
2010-09-06 01:46:06 +00:00
Michael Martin
74d5088c7d [usb/usbhub]
- Start rewrite of usbhub driver using the old and dead usbhub driver in trunk.
- Implement QueryRootHub for sending USB request to miniport driver.
- Implement new IRP_MN_START_DEVICE.  
Get the roothubs PDO and FDO and forward the start device down to start the PDO.
Get USBDI and HUB interfaces. Set all ports as returned by DCI GetExtendedHubInformation to powered and reset.
- Temporary add some usb specific defines until header is fixed.
- Fix Formatting.



svn path=/trunk/; revision=48705
2010-09-05 19:00:37 +00:00
Michael Martin
639f26f1b5 [usb/usbehci]
- Fix flags settings for PortStatus and PortChange so that the correct flags are set when hub driver sets/requests them.
- Use FastMutex to protect access to async queue and frame list.
- For USB CONFIG DESC, Check the output buffer size before attempting to write all configuration descriptors.
- Fix a bug that caused bmRequestType to be incorret value when requesting configuration and string descriptors.
- Modify some debugging to make it easier to see debug messages from usbhub driver.

svn path=/trunk/; revision=48704
2010-09-05 18:43:17 +00:00
Cameron Gutman
38a87f0176 [USETUP]
- Add the option to write only the VBR so FreeLoader can easily be chain loaded by GRUB or another boot loader
- Dedicated to James Tabor :)

svn path=/trunk/; revision=48703
2010-09-05 17:09:18 +00:00
Timo Kreuzer
113c47805c Update the GAS compatible fathelp.S file to reflect the latest changes to the original file (freeldr PE conversion). This version is tested and works.
svn path=/trunk/; revision=48701
2010-09-05 16:03:08 +00:00
Cameron Gutman
f276fcd056 [USETUP]
- Remove code that was corrupting disk data and causing setup to fail in rare cases
- Write the MBR in all cases (Windows setup behavior too)
- We can overwrite GRUB and LILO now but we still can't boot because we have trouble reading the partition table if it was made in Linux

svn path=/trunk/; revision=48700
2010-09-04 20:56:19 +00:00
Sir Richard
edfb344c53 [NTOS]: Remove useless variables in kernel code that were set, but never actually used (dead code, tests, copy/pasters). If a variable was set but not used because of missing/#if'ed out code, a note was added instead.
[NTOS]: In the process, fix bugs in the Event dispatcher code that used Win32 EVENT_TYPE instead of NT KOBJECTS enumeration.
[NTOS]: Fix a bug in ObpInsertHandleCount, where the object access check was being done with the previous mode, instead of honoring the probe mode, which is defined by OBJ_FORCE_ACCESS_CHECK.
[NTOS]: Fix a bug in a section function which was always returning STATUS_SUCCESS, now it returns the result of the previous Status = function assignment. If this isn't desired, then don't check for the Status anymore.
[NTOS]: Note that MDL code does not support SkipBytes argument. If it is used, MDL could be invalid.
[NTOS]: Add checks for VerifierAllocation and set it when needed (WIP).
[NTOS]: Clarify what _WORKING_LINKER_ is, and the legal risks in continuing to use a linker that builds non-Microsoft drivers when used with headers whose EULA specify that they can only be used for Microsoft drivers.

svn path=/trunk/; revision=48692
2010-09-04 08:17:17 +00:00
Cameron Gutman
93ae36ab99 [OSKITTCP]
- Check for a shutdown connection that we missed a few times
- Remove some junk and stop playing with flags behind oskit's back
- Fix an invalid parameter check
- Enable a check to ensure that accept doesn't get called for a socket that isn't listening
- Use the queue manipulation function instead of manually changing the queue
- Signal that we accepted/connected a socket
[IP]
- Set the network mask and destination address in TCPGetInterfaceData

svn path=/trunk/; revision=48686
2010-09-02 04:18:17 +00:00
Aleksey Bragin
33fffd0b38 [PSDK]
- Add BS_TYPEMASK definition.

svn path=/trunk/; revision=48678
2010-09-01 13:40:35 +00:00
Amine Khaldi
ef43524fff [CRT]
- Fix __MINGW_MSC_PREREQ logic.

svn path=/trunk/; revision=48657
2010-08-30 13:48:40 +00:00
Michael Martin
9b7e628d96 Patch by Pierre Schweitzer.
[CDFS]
- Several fixes for directory information query.
- Fixed a null access memory under certain circumstances.
- Added support for media ejection.
[FASTFAT]
- Fixed calls to CcMapData(), CcPinRead().
- Fixed an endless loop in FCB management under certain circumstances.
[NTOSKRNL]
- Fixed wrong prototype for IopParseDevice().

svn path=/trunk/; revision=48654
2010-08-30 11:51:17 +00:00
Sir Richard
c574f50663 [NTOS]: Add an extra layer of protection for freed nonpaged pool: write a 4-byte signature on freed blocks, and assert its valid on checked builds. Use a slightly less egocentric ASCII value than on Windows (name of the developer who wrote the first memory manager).
svn path=/trunk/; revision=48651
2010-08-29 19:32:25 +00:00
Sir Richard
b85ab20f13 [NTOS]: Missed a bunch of codepaths, protected pool "should" work now.
svn path=/trunk/; revision=48650
2010-08-29 19:27:58 +00:00
Sir Richard
cf28a01e5e [NTOS]: Add DRIVER_CAUGHT_MODIFYING_FREED_POOL bugcheck code.
[NTOS]: Add support for protected freed nonpaged pool. This is controlled through MmProtectFreedNonPagedPool, which is initialized based on a registry value (see cmdata.c). This is not "Special Pool", but a useful debugging feature Windows implements that we now have too, since I noticed a lot of mj's work was with freed pool access.
NB. It's 3AM and I have not tested this, it should be off in trunk by default, you'll need to try turning it on and testing it. Hope it helps.
--This line, and those low, will be ignored--

M    ntoskrnl/mm/ARM3/pagfault.c
M    ntoskrnl/mm/ARM3/pool.c
M    include/reactos/mc/bugcodes.mc

svn path=/trunk/; revision=48649
2010-08-29 19:13:08 +00:00
Cameron Gutman
1afef0ace6 [ACPI]
- Read and report ACPI_RESOURCE_TYPE_FIXED_MEMORY32

svn path=/trunk/; revision=48648
2010-08-29 18:40:33 +00:00
Michael Martin
52929981d9 [cdfs]
- Working with Pierre Schweitzer for yet another NonPaged Pool corruption fix. When copying VolumeLabel the VolumeLabelLength is in Unicode, so theres no need to mulitply it by size of WCHAR. 

svn path=/trunk/; revision=48646
2010-08-29 17:46:18 +00:00
Timo Kreuzer
69814e0c5b [NTOSKRNL]
Modified version of r48640: 
- update the NodeHint to the root node when deleting a node
- remove this code from MmCleanProcessAddressSpace

svn path=/trunk/; revision=48642
2010-08-29 08:35:54 +00:00
Michael Martin
fbf071095a [ntoskrnl]
- Revert 48640, as it was incorrect.

svn path=/trunk/; revision=48641
2010-08-29 07:18:47 +00:00
Michael Martin
690399c881 [ntoskrnl]
- When a node is removed, check the NodeHint of the table to see if it matches the one being removed. If so update the NodeHint to the PreviousNode. FIxes VAD corruption messages.

svn path=/trunk/; revision=48640
2010-08-29 07:00:52 +00:00
Cameron Gutman
73e641d29b - Disable ACPI again
svn path=/trunk/; revision=48639
2010-08-29 03:51:21 +00:00
Cameron Gutman
2450e46a56 [NTOSKRNL]
- Fix a regression in ACPI function from r48581
- Enable ACPI for testing purposes (will be disabled next commit)

svn path=/trunk/; revision=48638
2010-08-29 03:48:59 +00:00
Cameron Gutman
c8ff03d682 [TCPIP]
- Don't allocate pool if there is nothing in the route table
- Fixes bug 5493

svn path=/trunk/; revision=48637
2010-08-29 02:29:10 +00:00
Michael Martin
a3370efc0a [win32k]
- Mouse messages can be sent before the desktop is initialized. Check for this and return false if its not. FIxes assert when moving mouse before desktop is up.

svn path=/trunk/; revision=48636
2010-08-28 23:55:27 +00:00
Michael Martin
a5bab7504e [input/i8042prt]
- Fix a check when queuing the mouse packet. Check that the buffer size (MouseInBuffer) is not greater or equal to MouseDataQueueSize. Fixes a NonPagedPool corruption that occurs when the mouse is moved before the desktop window is up and running.

svn path=/trunk/; revision=48635
2010-08-28 23:23:43 +00:00
Michael Martin
87e8d75f00 [ntoskrnl/ps]
- When deleting a Process remove the Process from the MmProcessList. Fixes random NonPaged Pool corruptions.  Thanks aicom for assistance.

svn path=/trunk/; revision=48632
2010-08-28 00:26:02 +00:00
Michael Martin
a9e0dc23a4 [ntoskrnl/ps]
- Acquire and Release RundownProtection on the Parent Pocess not the newly created Pcess when setting the SectionObject.

svn path=/trunk/; revision=48631
2010-08-27 22:18:10 +00:00
Timo Kreuzer
3a325683bc [WIN32K]
- Rework EngSetPointerShape, to first allocate the neccessary surfaces, before deleting the old ones. Also check in IntShowMousePointer if a saving surface is present. This way a failure to allocate a surface will not result in a crash, but keep the old mouse pointer.

See issue #5402 for more details.

svn path=/trunk/; revision=48630
2010-08-27 10:57:54 +00:00
Timo Kreuzer
cb6ae2faab [USER32]
- Revert r47238 as requested by Giannis: "this commit breaks any program that wants to subclass mdi client windows"

svn path=/trunk/; revision=48629
2010-08-27 10:20:25 +00:00
Cameron Gutman
b0a5ac396e [OSKITTCP]
- Only tell the caller how much we sent/received if it completed successfully
- Set SO_DONTROUTE on accepted sockets too
- Disable the core routing code
- Make our MSS calculation much better by sharing the existing code

svn path=/trunk/; revision=48628
2010-08-27 04:46:04 +00:00
Colin Finck
9f187ad465 Fix building on newer Linux systems (particularly Fedora 13)
Thanks to James, Sylvain and ErVito for testing!

See http://reactos.org/pipermail/ros-dev/2010-August/013338.html for more details

svn path=/trunk/; revision=48627
2010-08-26 18:33:46 +00:00
Timo Kreuzer
e04ebf1980 [NTOSKRNL]
- Fix to PpSetCustomTargetEvent(), not to make caller wait forever in case it provided an event it waits for
- Patch by Pierre Schweitzer

svn path=/trunk/; revision=48626
2010-08-26 15:25:33 +00:00
Timo Kreuzer
6ddec3f063 Fix build
svn path=/trunk/; revision=48625
2010-08-26 02:48:03 +00:00
Cameron Gutman
0553d5160c [OSKITTCP]
- Prevent multiple wakeups for the same event which caused nasty problems for the SEL_FIN event because we dereferenced our connection context 3 times which not only caused the connection endpoint to be freed while holding its spin lock but made the reference count negative
[TCPIP]
- Disassociate the address file from the connection endpoint before dereferencing/closing it to avoid a double dereference of the address file (not as harmful in this case as in the connection endpoint case)
[IP]
- Dereference the connection endpoint again if it was associated with an address file as the connection endpoint to fix a reference leak

svn path=/trunk/; revision=48624
2010-08-26 02:29:38 +00:00
Timo Kreuzer
1b2ab4ce31 [NTDLL_APITEST]
- Add a test for RtlInitializeBitMap.

svn path=/trunk/; revision=48623
2010-08-26 02:29:19 +00:00
Timo Kreuzer
da3e12b450 delete old Zwcontinue test
svn path=/trunk/; revision=48622
2010-08-25 10:15:34 +00:00
Timo Kreuzer
14d5a266b3 [ROSTESTS]
- Add wine style ntdll_apitest and move test for ZwContinue there

svn path=/trunk/; revision=48621
2010-08-25 10:15:01 +00:00
Timo Kreuzer
57434c8ebf Add missing files
svn path=/trunk/; revision=48620
2010-08-25 08:50:10 +00:00
Timo Kreuzer
ecc6804976 [APITESTS]
Convert dciman32api, user32api and wa2_32 into wine style tests

svn path=/trunk/; revision=48619
2010-08-25 08:48:55 +00:00
Timo Kreuzer
967f731f6a [FASTFAT]
- "Fix for a stupid mistake"
- patch by Pierre Schweitzer

svn path=/trunk/; revision=48618
2010-08-25 08:29:52 +00:00
Timo Kreuzer
e3a2103631 Convert gdi32api into wine style test
svn path=/trunk/; revision=48617
2010-08-24 13:54:10 +00:00
Timo Kreuzer
bc064d7ed4 Fix copy paste error in file header
svn path=/trunk/; revision=48616
2010-08-24 05:27:39 +00:00
Timo Kreuzer
fdd4f2b50b [REGTESTS]
Add bugs_regtest. This can be used to create testcases / regression tests for already fixed bugs. I added a first test for bug 3481

svn path=/trunk/; revision=48615
2010-08-24 05:20:16 +00:00
Timo Kreuzer
337a1faad6 [WINGDI.H]
Add missing GetCharWidthI, GetTextExtentExPointI, GetTextExtentPointI

svn path=/trunk/; revision=48614
2010-08-24 05:19:31 +00:00
Cameron Gutman
0ea1a11d0d - Revert the change from REG_SZ to REG_MULTI_SZ because it turns out that Windows does it this same way (research fail?)
svn path=/trunk/; revision=48611
2010-08-23 21:11:01 +00:00
Timo Kreuzer
2ddee30677 [NTOSKRNL]
- Rewrite MiFindEmptyAddressRangeDownTree. The old implementation's "most awesome loop" duplicated both the initialization and the interation steps. It was also overcomplicated. The new implementation additionally returns the parent for the following table insertion, so this doesnt need to be done in an extra search. The return value is changed from NTSTATUS to TABLE_SEARCH_RESULT
- Modify MiInsertNode to accept a parent and TABLE_SEARCH_RESULT instead of searching for a free location.
- Modify MiCreatePebOrTeb to make use of the new features
- Handle failed allocation of the PEB/TEB
- Fixes a failed assertion that Olaf got
- I tested this code quite some time and no problems were found

svn path=/trunk/; revision=48606
2010-08-23 03:00:03 +00:00
Timo Kreuzer
b8e0dc9948 [WIN32K]
Seperate DC_vSetLayout from NtGdiSetLayout and save the old value before setting the new one.

svn path=/trunk/; revision=48605
2010-08-23 01:41:56 +00:00
Timo Kreuzer
7aa6c115ea [WIN32K]
Move the allocation of the vis region of the DC to a later position, so that all mandatory fields are initialized before we try to delete the DC in failure case. Fixes yet another possible crash.

svn path=/trunk/; revision=48604
2010-08-23 01:39:28 +00:00
Timo Kreuzer
35eedf6749 [NDK]
Add LdrProcessRelocationBlockLongLong. Fixes build, sorry.


svn path=/trunk/; revision=48603
2010-08-23 01:18:09 +00:00
Cameron Gutman
8d77a3fe00 [TCPIP]
- Read the IP information from the interface key inside the Tcpip service key (confirmed on XP)
- Fix a logic error in my code (no idea how I missed it)
- Restores static IP functionality (still waiting on janderwald to fix netcfgx's DNS value writing)

svn path=/trunk/; revision=48602
2010-08-23 01:17:41 +00:00
Timo Kreuzer
ca6ff51038 [NTDLL]
- Call LdrProcessRelocationBlockLongLong from LdrProcessRelocationBlock instead of duplicating the code

svn path=/trunk/; revision=48601
2010-08-23 01:16:42 +00:00
Amine Khaldi
3957ae1572 [FAULTREP]
- Fix a typo.

svn path=/trunk/; revision=48600
2010-08-23 00:02:06 +00:00
Timo Kreuzer
314e02e2f0 [WIN32K] / [GDI32]
- GetTextExtentExPointI and GetTextExtentPointI take an array of glyph indices, not characters. Pass a flag GTEF_INDICES (This is a reactos specific definition and not exactly like on Windows XP, but the real names/values are undocumented and this is the easiest way.) to NtGdiGetTextExtent/NtGdiGetTextExtentExW and handle this flag in TextIntGetTextExtentPoint to account for this.
Fixes bug 3481

svn path=/trunk/; revision=48597
2010-08-22 23:38:02 +00:00
Timo Kreuzer
dfce6bb843 [WIN32K]
- When doing a cleanup for a DC, check, if the default brushes are set, before dereferencing them. Fixes a possible kernel mode crash.
- Remove some obsolete casts

svn path=/trunk/; revision=48595
2010-08-22 22:44:36 +00:00
Cameron Gutman
617f243c3f [DHCPCSVC]
- Write the DNS servers in a REG_MULTI_SZ value
[IPHLPAPI]
- Rewrite the registry reading code
- Use HeapFree to free memory from the allocated from heap

svn path=/trunk/; revision=48593
2010-08-22 22:22:27 +00:00
Amine Khaldi
f8199cb9e0 [PSDK]
- Improve _MSC_VER related conditions.
- Comment on #endif (for readability).
- DECLSPEC_ALIGN : moar underscores !
- Apply a consistent formatting.

svn path=/trunk/; revision=48590
2010-08-22 13:25:10 +00:00
Cameron Gutman
7f865763fa [NTOSKRNL]
- Fix a typo that broke handling of DevicePropertyEnumeratorName inside IoGetDeviceProperty

svn path=/trunk/; revision=48583
2010-08-21 22:08:00 +00:00
Timo Kreuzer
9280f1e1c3 [WIN32K]
Use the object type index, not the shifted full object type to decide what to do with an object in NtGdiDeleteObjectApp. Fixes leaking derived types such as pens.

svn path=/trunk/; revision=48582
2010-08-21 22:00:50 +00:00
Cameron Gutman
0d3516871b [NTOSKRNL]
- Don't overwrite the ACPI hardware key on every boot

svn path=/trunk/; revision=48581
2010-08-21 21:39:53 +00:00
Cameron Gutman
68eef5481f [NTOSKRNL]
- Append the DLL name and NULL terminate the string more nicely

svn path=/trunk/; revision=48580
2010-08-21 21:25:07 +00:00
Timo Kreuzer
80cc3a0e88 [WIN32K]
- Allocate the DCs prgnVis in DC_AllocDC, instead of "on demand" in GdiSelectVisRgn and properly handle failure case. This fixes a possible crash, when running out of gdi handles.

svn path=/trunk/; revision=48579
2010-08-21 19:55:09 +00:00
Timo Kreuzer
02cb45ab9c [WIN32K]
- co_IntTranslateMouseMessage: properly initialize *HitTest and only send WM_NCHITTEST when the message is going to be removed
- co_IntPeekMessage: Prevent possible use of uninitialized HitTest by ProcessMouseMessage()
- Patch by Jan Roeloffzen [jroeloffzen at hotmail dot com]
- Fixes bug 2139

svn path=/trunk/; revision=48576
2010-08-20 19:24:48 +00:00
Amine Khaldi
ca4003c9f8 [PSDK]
- Add missing DISPLAY_BRIGHTNESS and some related definitions.

svn path=/trunk/; revision=48575
2010-08-20 16:55:33 +00:00
Cameron Gutman
5122323eb8 [NTOSKRNL]
- The trailing NULL is NOT included in the string length
- IopNotifyPlugPlayNotification needs a pointer to an actual GUID not a UNICODE_STRING
- The Power Manager can now see ACPI power devices again
- ROS will now do a graceful shutdown and power off if the power button is pressed and ACPI is enabled

svn path=/trunk/; revision=48574
2010-08-20 04:45:25 +00:00
Cameron Gutman
1883a6f208 [ACPI]
- Do all of the work inside the DPC so we don't have IRQL issues when entering the memory manager
- This is a slight hack but we can be assured that data won't be over 24 bits unless somebody wants to push the power/sleep button over 16 million times

svn path=/trunk/; revision=48573
2010-08-20 03:08:50 +00:00
Cameron Gutman
62f520433c [NTOSKRNL]
- Shutdown the system if we receive a SYS_BUTTON_POWER event
- Register for GUID_DEVICE_LID arrival events so we can receive lid events

svn path=/trunk/; revision=48572
2010-08-20 02:27:05 +00:00
Cameron Gutman
ab9dae987d [NTOSKRNL]
- Add a special case to IopInitializeDevice for raw devices
- Call IopInitializeDevice to set up our device node and ready it to start
- Fixes assertions hit by ACPI and PCIX

svn path=/trunk/; revision=48570
2010-08-19 23:26:44 +00:00
Cameron Gutman
8d8399c2e5 [OSKITTCP]
- Disable routing because oskit needs to let our code do that
- Comment out the ACK hack and restore the default BSD behavior

svn path=/trunk/; revision=48569
2010-08-19 22:15:58 +00:00
Michael Martin
6a0074f795 [Win32k]
- For SetTimer nIDEvent can be 0 in which case return 1. Zero still needs to be used for nIDEvent when killing the timer. Fixes bug 5553.
- Modify windowless timers to use IDEvent values decrementing from the max number of windowless timers vice incrementing from 1. Done to match windows behavior.


svn path=/trunk/; revision=48568
2010-08-19 10:52:36 +00:00
Timo Kreuzer
f87ad01e1a [NTOSKRNL]
- Add missing parentheses. Fixes "cont"

svn path=/trunk/; revision=48567
2010-08-19 10:03:03 +00:00
Timo Kreuzer
681307ff21 [NTOSKRNL]
Fix handling of next instruction in kdbg.
Patch by Daniel Zimmermann, modified by Aleksey Bragin

See issue #4457 for more details.

svn path=/trunk/; revision=48566
2010-08-19 09:03:36 +00:00
Timo Kreuzer
6fb40574c2 [NTOSKRNL]
- Implement support for /BURNMEMORY option.
- Don't stop boot on bad memory type
Patch by Jay Smith, modified by Aleksey, even more modified by me.

See issue #4957 for more details.

svn path=/trunk/; revision=48565
2010-08-19 08:50:23 +00:00
Cameron Gutman
44e8a7f7b6 [NETSTAT]
- Allocate memory for the TCP table properly
- Only netstat -a should show UDP connections
- Patch by Jan Roeloffzen [jroeloffzen at hotmail dot com]

svn path=/trunk/; revision=48564
2010-08-19 06:25:20 +00:00
Cameron Gutman
f2d4e1a828 [IPHLPAPI]
- Copy our TCP table into the caller's buffer if we actually get one (not yet!)
- Return ERROR_NO_DATA if we fail to get anything from TCP/IP
- Fixes bug #4185

svn path=/trunk/; revision=48563
2010-08-19 06:05:35 +00:00
Timo Kreuzer
5ae5a35726 [NTOSKRNL]
- Initialize the Parent member of the new Vad to NULL. This also initializes the Balance to 0 aka RtlBalancedAvlTree
Should fix the failed assertion that randomly occurs.

svn path=/trunk/; revision=48562
2010-08-19 05:10:16 +00:00
Cameron Gutman
8f474295b5 [IP]
- Fix a major bug in socket closure. Prior to this, a socket with pending IRPs that could not be satisfied when the socket was closed would be destroyed without completing the pending requests. Now, we check all of our IRP queues if we get a SEL_FIN signal and kill all the requests that cannot be satisfied immediately.
- Maybe it's just me but Firefox 2 seems much more responsive after this fix (like actually usable!)

svn path=/trunk/; revision=48561
2010-08-19 02:41:54 +00:00
Timo Kreuzer
1cbf4c4057 [FASTFAT]
Make our FAT driver PNP aware.
On PNP requests it should handle, it will return STATUS_NOT_IMPLEMENTED.
On the others, it will pass them to lower driver.
This is the first step outside the kernel into getting IoGetRelatedTargetDevice (and so notifications) working.
It doesn't work at the moment, as class2 doesn't handle PNP.

[NTOSKRNL]
Some fixes to IRP cancelation process:
- Renamed IopRemoveThreadIrp() to IopDisassociateThreadIrp() to match Windows 2k3
- Made dead IRP global, to make its debug easier.
- IopDisassociateThreadIrp(), Handle dead IRP at dispatch level, using IoCompletionLock.
- IopDisassociateThreadIrp(), Use the proper error code to write the entry to logs.
- IoCancelIrp(), removed non needed ASSERT, which is even not present on Windows, removed corresponding var as well.
- IoCancelIrp(), fixed parameters to KeBugCheckEx() call.
- IoCancelThreadIo() is pageable.
- IoCancelThreadIo() under Windows isn't using given thread, but using current. Do the same here.
All that stuff doesn't fix bug #5550, it comes from outside.

Patch by Pierre Schweitzer, modified by me to make it compile. If it breaks anything, don't blame me!

svn path=/trunk/; revision=48560
2010-08-18 23:21:15 +00:00
Timo Kreuzer
3d5db91752 [NTOSKRNL]
- Simplified IopGetRelatedTargetDevice implementation
- Added notification in case of success in NtSetVolumeInformationFile()
Patch by Pierre Schweitzer

svn path=/trunk/; revision=48559
2010-08-17 16:04:46 +00:00
Timo Kreuzer
2ded5adf7c [NTOSKRNL]
- Fixed IoGetRequestorProcess, IoGetRequestorProcessId, IoGetRequestorSessionId
- Pass user buffer in NtNotifyChangeDirectoryFile
- Fixed magic value in IoGetPagingIoPriority
Patch by Pierre Schweitzer

svn path=/trunk/; revision=48557
2010-08-16 20:18:25 +00:00
Timo Kreuzer
49a96cdea9 [NTDLL]
LdrPerformRelocations: Delta is a LONG_PTR rather than ULONG_PTR

See issue #5577 for more details.

svn path=/trunk/; revision=48556
2010-08-16 01:57:09 +00:00
Timo Kreuzer
40f30e9422 [WIN32K]
- Remove IntEngExtEscape stub. This function is completely useless. If the driver doesn't provide a DrvEscape, the function should simply fail and must return 0, not -1.
- If a NULL surface is passed, pass on NULL pso to the driver function

See issue #4563 for more details.

svn path=/trunk/; revision=48555
2010-08-16 01:29:13 +00:00
Timo Kreuzer
d35828af5a [user32_winetest]
Skip 2 tests that hang on reactos. Patch by Giannis Adamopoulos

svn path=/trunk/; revision=48554
2010-08-16 00:06:55 +00:00
Aleksey Bragin
a81b1fdd76 [NTOSKRNL]
- Revert 48546. The code was correct, and there is more of same code in other places which firstly cancels the IRP and then moves to the next entry. The actual bug is somewhere else.
See issue #5550 for more details.

svn path=/trunk/; revision=48551
2010-08-15 08:48:03 +00:00
evb
fd24107d7d - IRP_MN_QUERY_RESOURCE_REQUIREMENTS half support now, PciQueryRequirements, PciAllocateIoRequrementsList, full implement, but PciBuildRequirementsList return 0 always for now
- Debug helpers: PciDebugPrintIoResReqList, PciDebugPrintIoResource, PciDebugCmResourceTypeToText
Now hit assert Assertion '(DeviceNode->Flags & DNF_ADDED)' failed at ntoskrnl/io/pnpmgr/pnpmgr.c line 201, too night to debug, maybe tomorow

svn path=/trunk/; revision=48550
2010-08-14 18:06:19 +00:00
evb
d9bd0072a1 - IRP_MN_QUERY_RESOURCES support for PDO (PciQueryResources, PciAllocateCmResourceList), now remain IRP_MN_QUERY_RESOURCE_REQUIREMENTS to last device stack interogration from PNPMGR
svn path=/trunk/; revision=48549
2010-08-14 17:33:10 +00:00
evb
af01479fbf - Add support for PnP IRP to PDO: IRP_MN_QUERY_BUS_INFORMATION (PciQueryBusInformation), IRP_MN_QUERY_ID (PciQueryId), IRP_MN_QUERY_DEVICE_TEXT (PciQueryDeviceText), IRP_MN_QUERY_CAPABILITIES (PciQueryCapabilities), IRP_MN_QUERY_DEVICE_RELATIONS (PciQueryTargetDeviceRelations implement, PciQueryEjectionRelations, stub)
- Stub support for PnP IRP to PDO: IRP_MN_QUERY_RESOURCE_REQUIREMENTS (PciQueryRequirements), IRP_MN_QUERY_RESOURCES(PciQueryResources)
- Add support for PnP IRP to FDO: IRP_MN_QUERY_CAPABILITIES (handle in PciFdoIrpQueryDeviceCapabilities)
- Build device capability UI number (PciDetermineSlotNumber), use PIR$ (seem support broken, need to check loader) or device property for bus not root
- Use parent attachee device and this PDO for build device/system wake states, latency, device/system power mappings
- PCI-ID manage support: PciInitIdBuffer, PciIdPrintf, PciIdPrintfAppend
- Debug helper: PciDebugDumpQueryCapabilities
- Thanks richard for advise + beer
PCI-X driver now pass 10000 codes lines!

svn path=/trunk/; revision=48548
2010-08-14 17:09:20 +00:00
Cameron Gutman
912704ceb8 [NTOSKRNL]
- Move to the next entry in the thread IRP list before calling IoCancelIrp because if everything works as expected and IoCompleteRequest is called, we could end up with the IRP ripped out from under us before can move to the next element
- See issue #5550 for details.

svn path=/trunk/; revision=48546
2010-08-14 14:55:12 +00:00
Cameron Gutman
ccfa72f607 [WS2_32]
- Create a temporary variable and pass that to WSAIoctl for the bytes returned value instead of passing argp and corrupting the value we just retrieved

svn path=/trunk/; revision=48545
2010-08-14 13:48:31 +00:00
Aleksey Bragin
0be662421f [WINLOGON]
- NtInitializeRegistry expects not just CM_BOOT_FLAG_ACCEPTED, but a number of the accepted control set to be added to it. After fixing this, NtInitializeRegistry won't fail with STATUS_INVALID_PARAMETER (someone should check return status for errors...) anymore. As a result lazy flushing is enabled.

svn path=/trunk/; revision=48536
2010-08-13 22:02:17 +00:00
Aleksey Bragin
e68f31b46a [FASTFAT_NEW]
- Implement asynchronous and delayed close operations.
- Fix a logical bug in FatiClose code, which led to always closing the file object (and freeing respective FCB/VCB/CCB), and then checking flags and queuing a delayed close. Instead, it should only try to close if it's not marked as a delayed close.
- Support stuff added (queues, mutex for closing lists, etc).
- Misc cleanup, debug silencing.

svn path=/trunk/; revision=48525
2010-08-12 21:59:22 +00:00
Cameron Gutman
8d3e4feb39 - I hate catching these things as the commit is going out
svn path=/trunk/; revision=48523
2010-08-12 13:15:35 +00:00
Cameron Gutman
17e0e75eb5 [MSAFD]
- Update lpcbBytesReturned when FIONREAD is called
- Fix the value inside lpErrno when XxxSocketInformation() fails
- Pass the unrecognized IOCTLs to the winsock helper (no behavior change for this yet because wshtcpip's WSHIoctl is unimplemented)

svn path=/trunk/; revision=48522
2010-08-12 13:13:19 +00:00
Aleksey Bragin
11f2175562 [FASTFAT_NEW]
- Plug in a commented out notification call in case of cleanup.
- Implement a case of device info query.
- Implement lock control.

svn path=/trunk/; revision=48518
2010-08-11 12:18:24 +00:00
Timo Kreuzer
aac1625f1f [NTOSKRNL]
Stop using the new paged pool code, before ExpLoadInitialProcess is called. For so far unknown reasons, it causes evil things to happen. Fixes "Assertion NewSize < pool->UserSize failed"
See issue #5551 for more details.

svn path=/trunk/; revision=48517
2010-08-11 01:22:06 +00:00
Amine Khaldi
da140c1ba3 [DDK]
- De-duplicate __GNU_EXTENSION.
- Apply a consistent formatting.

svn path=/trunk/; revision=48514
2010-08-10 20:50:55 +00:00
Aleksey Bragin
94c9f4008f [FASTFAT]
Pierre Schweitzer
- Fix volume opening on FAT volume. Commented out a directory check as it doesn't match realized tests, in spite of what's in WDK.

svn path=/trunk/; revision=48513
2010-08-10 20:08:31 +00:00
Amine Khaldi
0fb515fa5b [XDK]
- Introduce some _ANONYMOUS_STRUCT and NONAMELESSUNION based definitions.
[DDK]
- Update XDK generated headers to reflect the recent changes.
- Update some header guards.
- Add some missing new lines at the end of files.
- Fix PUSB_DEVICE_HANDLE guard.
- Introduce some _ANONYMOUS_STRUCT and NONAMELESSUNION based definitions.
[PSDK]
- Update some header guards.
- Add missing new line at the end of driverspecs.h
[NDIS]
- Update the ndis header guard.

svn path=/trunk/; revision=48511
2010-08-10 13:53:10 +00:00
Amine Khaldi
07bb7dd863 [PSDK]
- Add some missing headers' headers.

svn path=/trunk/; revision=48510
2010-08-10 11:27:27 +00:00
Amine Khaldi
3e2e35f5db [PSDK]
- Add WINELIB_NAME_AW and DECL_WINELIB_TYPE_AW to the wine specific imm.h.

svn path=/trunk/; revision=48509
2010-08-10 10:25:10 +00:00
Cameron Gutman
1fde230130 [WS2_32]
- Fix a crash when running with ws2_32 debugging on

svn path=/trunk/; revision=48507
2010-08-10 07:14:42 +00:00
Timo Kreuzer
713d12fd47 Add include guards in wine/ddk/imm.h and inlude it from wine/imm.h
svn path=/trunk/; revision=48503
2010-08-10 01:08:03 +00:00
Amine Khaldi
a334719f12 [PSDK]
- Move INPUTCONTEXT and ImmLockIMC to the wine imm.h
- Add wingdi.h inclusion.

svn path=/trunk/; revision=48502
2010-08-10 00:46:27 +00:00
Timo Kreuzer
2bf65890b7 [WIN32K] Fix NtGdiMaskBlt to handle patterns correctly, use SRCAND, which is more optimized, instead of DSTERASE, and set fore and background colors correctly to not destroy alpha channel.
[SHELL32] Use MaskBlt to draw the shortcut overlay
Finally fixes bug 5455. Forever. (I hope.)

svn path=/trunk/; revision=48501
2010-08-09 23:28:19 +00:00
Amine Khaldi
329c3e4970 [PSDK]
- Add some missing imm.h definitions.
[IMM32]
- Fix imm.h inclusion.
[IPHLPAPI]
- Fix tdiinfo.h inclusion.

svn path=/trunk/; revision=48500
2010-08-09 22:53:07 +00:00
Amine Khaldi
7e8308d2f2 [DDK]
- Move several headers to PSDK where they belong.
[PSDK]
- ddrawi.h : Fix pUnkOuter.

svn path=/trunk/; revision=48499
2010-08-09 22:20:05 +00:00
Aleksey Bragin
03d3e84856 [FASTFAT_NEW]
- Implement opening an existing DCB.
- Add a bunch of useful macros and helper functions and use them throughout the code.
- Implement in-memory setendoffile set information class. On-disk to be done.
- Implement user fs ctrl wrapper with stubs.
- Fill up QueryVolumeInfo with classes it should handle. Silence up a warning about classes it should reject.

svn path=/trunk/; revision=48498
2010-08-09 21:33:17 +00:00
Amine Khaldi
e787f57ee7 [DDK]
- Move several headers to PSDK where they belong.
- Add _ANONYMOUS_UNION.
- De-duplicate __GNU_EXTENSION definition from several headers.
- Remove semicolons after the closing bracket of extern "C"
- Add a missing one in ioaccess.h
- Apply a consistent formatting.
[PSDK]
- De-duplicate __GNU_EXTENSION definition from several headers.
- Add missing extern "C" opening bracket in ddkernel.h and remove the semicolon from the closing one.
- Add __GNU_EXTENSION definition to ddraw.h and remove the semicolon after the closing bracket of extern "C"
- Add missing extern "C" closing bracket in ddrawi.h
- Remove semicolons after the closing brackets of extern "C" in dinput.h, dmemmgr.h and sti.h
- Apply a consistent formatting.
[DXSDK]
- Move ddraw.h to PSDK.

svn path=/trunk/; revision=48497
2010-08-09 20:58:47 +00:00
Aleksey Bragin
07a6bcfb57 Carlo Bramix
- Prevent possible out-of-bounds access.
See issue #5505 for more details.

svn path=/trunk/; revision=48495
2010-08-09 20:41:41 +00:00
Aleksey Bragin
9d1462a2b7 Pierre Schweitzer
- A better fix for CdfsIsNameLegalDOS8Dot3.

See issue #2404 for more details.

svn path=/trunk/; revision=48494
2010-08-09 20:38:12 +00:00
Cameron Gutman
6cb85c8ae3 [DHCPCSVC]
- Set the SO_BROADCAST option to 1 before we send data to the broadcast address so we don't get stonewalled by mswsock
- DHCP is now compatible with mswsock_new

svn path=/trunk/; revision=48493
2010-08-09 20:37:32 +00:00
evb
55f39ef1a3 Support PCI device resource dicsovery for limit and current now, so bridge + device BAR functionning
PciScanBus second pass enabled: PciProcessBus, most stubs now until VGA/ISA system tested
PciClassifyDeviceType implement as helper function
PCI Enumeration 100% complete!

svn path=/trunk/; revision=48492
2010-08-09 19:07:52 +00:00
Cameron Gutman
f83e778875 [WS2_32]
- Check the return value of WSPSelect instead of the error number because the error number doesn't have to be initialized if the function doesn't return SOCKET_ERROR

svn path=/trunk/; revision=48491
2010-08-09 15:42:51 +00:00
Aleksey Bragin
f1a6ba977a [FASTFAT_NEW]
- Implement close and cleanup infrastructure.
- Add necessary FCB and VCB counters.
- Add missing op and file locks initialization.
- A lot of small cleanups, improvements, and other things, bringing fastfat_new much closer to a minimally working state.

svn path=/trunk/; revision=48487
2010-08-08 10:43:28 +00:00
Aleksey Bragin
1dac3daaa1 Pierre Schweitzer
- Implemented CdfsIsNameLegalDOS8Dot3 and use it to check filenames. It avoids
calling Rtl* functions that need NLS. (Modified merge of 35501).
See issue #2404 for more details.

svn path=/trunk/; revision=48486
2010-08-08 08:24:19 +00:00
Timo Kreuzer
7dc11f26bf [TASKMGR]
- Use messages instead of events to notify the update threads
- Fixes a handle leak
- Fix some typos
- Patch by Carlo Bramini (carlo.bramix at libero dot it)

See issue #3104 for more details.

svn path=/trunk/; revision=48484
2010-08-08 03:41:33 +00:00
Timo Kreuzer
9caaf3d69c [KERNEL32] Convert default locales to actual locale identifiers, before passing to IsValidLocale(). Fixes corrupted file size strings in explorer.
[SHLWAPI] Fix some comments (As usual: "should be sent to wine")
Patch by Rafal Harabień, <rafalh1992 AT o2 DOT pl>

See issue #5557 for more details.

svn path=/trunk/; revision=48482
2010-08-07 22:41:23 +00:00
Timo Kreuzer
dfe0f8a1a1 [DDK]
Make functions in ntstrsafe.h static, so they can be used in more than one file. Maybe that encourages people using it instead of unsafe and banned apis.

svn path=/trunk/; revision=48481
2010-08-07 21:29:00 +00:00
Timo Kreuzer
0156668176 [NTOSKRNL]
Deferred success...

svn path=/trunk/; revision=48480
2010-08-07 21:22:00 +00:00
Sir Richard
c444de303a [NTOS]: Aleksey wants an easy way to see debug messages coming from one process vs. another, which is an obvious idea that should've done a long time ago. Now you can see who is generating a given debug message (including the thread).
svn path=/trunk/; revision=48479
2010-08-07 16:16:17 +00:00
Timo Kreuzer
4adeefec39 [KERNEL32]
Go back to spec file. Don't worry it's fixed.

svn path=/trunk/; revision=48478
2010-08-07 16:07:13 +00:00
Sir Richard
0be9ddc03e [KERNEL32]: Aleksey wants debug channels, I agree this is the way forward. Leverage existing NT infrastructure to enable Windows-compatible debug channel support, instead of using a UNIX-based 3rd party library. Same debug channel names as before have been re-added, but using NT Debug Filters.
svn path=/trunk/; revision=48477
2010-08-07 16:01:30 +00:00
Aleksey Bragin
4e45370f82 [KERNEL32]
- That's what happens when most of the commit's changes are not related to most of the commit message. Fixes build.

svn path=/trunk/; revision=48476
2010-08-07 09:10:06 +00:00
Sir Richard
e4d5c13a6b [KERNEL32]: While working on the CMAKE branch, Amine and myself discovered a rather serious issue in kernel32 (and perhaps other libraries as well). Unlike rbuild, CMake does not allow you to export non-existant DLL functions (try it: add "poopyhead" in kernel32's exports under RBuild, and will it export "poopyhead", God knowing what that will actually link to).
As an additional feature on top of the "allow non-existing functions to be exported" "feature", because rbuild generates and links STDCALL function names without the proper decoration (vs. enforcing decoration at linking, but only removing it at export-time), this allows the definition (as an export) of a STDCALL function that is completely different from the actual function itself.
            For example, the 5-parameter Foo function is normally Foo@20, while the 3-parameter Foo function woudl be Foo@12. Linking one against the other would fail (say, 2 parameters were added to Foo in a newer version). However, under RBUILD, both of these would appear as "Foo", and the linker/compiler would happilly connect the caller of Foo@3 (that has pushed 3 parameters) to the receiving side of Foo@5 (that is about to pop 5 parameters).
            Even -if- decorations WERE to be applied, Foo@12 would STILL succeed, because of the first feature, which would enable the export of Foo@12 even though no such function exist.
            In a further, bizare, twist of fate, the behavior of this RBUILD "feature", when the target function is not found, is to link the exported DLL TO ITSELF.
            Therefore, one can see how, previously to this patch, kernel32.dll would import a dozen functions from itself (all the non-existing functions).
            To really seal the deal, the behavior of exported functions used by kernel32, but that are actually forwarded to another DLL deserves a special mention.
            GetLastError, for example, merely forwards to RtlGetLastWin32Error, so it is normal behavior to use a #define in the C code so that all internal calls to the function are routed correctly.
            This did not happen, so instead, kernel32 tried importing/linking/exporting GetLastError, but this symbol is not found in the binary, because it is only a forwarder.
            This caused kernel32 to import from itself (the behavior when an exported symbol is not found). When importing from itself, the loader would now find the _forwarded_ for GetLastError, and correctly link with ntdll.
            What should be a one-liner of assembly (inline TEB access) thus became a triple-call indirection (GetLastError@0->StubLastError@0->__impGetLastError@0->__impRtlGetLastWin32Error->RtlGetLastWin32Error.
            While analyzing these issues, we also realized a strange macro SetLastErrorByStatus that manually tried to perform what there already exists a function for: RtlSetLastNtStatusFromWin32Error.
	    And, in an exciting coda, we also realized that our Server 2003 Kernel32 exports more than a dozen Windows 95 APIs, through an auto-stub generation mechanism within winebuild, that gets linked as an object behind the scenes.
[KERNEL32]: Removed all Win95 exports, cleaned up exports.
[KERNEL32]: Fixed up set/get error macros by making them inline and/or calling the correct ntdll function.
[KERNEL32]: Removed bizare calls to Wine-internal/specific APIs from our core Win32 DLL.
[KERNEL32]: Wrote stubs for all functions which should be exported, and set the correct number of parameters for them.
[KERNEL32]: Kernel32 is smaller, loads faster, does not export Windows 95 functions, does not export non-existing functions, and does not import from itself anymore.
Note: This is one of the many failings of RBUILD the CMAKE system has helped us discover. I believe these issues are serious enough to warrant an immediate sync with trunk, but rest assured, there are many more completely broken, infinitely-regressing things that we discovered while switching to CMAKE.


svn path=/trunk/; revision=48475
2010-08-07 05:02:58 +00:00
Cameron Gutman
9ce4714f6b [IPHLPAPI]
- Comment out the GetAdaptersAddresses code and add the stub back
- Fixes Firefox 3.x (bug 5399)

svn path=/trunk/; revision=48474
2010-08-06 23:01:10 +00:00
Timo Kreuzer
003e0bb556 [CRT]
- Remove "implementations" of __lc_collate_cp, __lc_handle and __lc_codepage. These are not functions, but varuables, implemented as MSVCRT_*
- add ___lc_codepage_func and ___lc_handle_func taken from wine
- Fix msvcrt spec file
- Fixes compilation with gcc 4.5.1

svn path=/trunk/; revision=48473
2010-08-06 22:42:07 +00:00
Aleksey Bragin
d521bf4480 - (Hack)fix build.
svn path=/trunk/; revision=48469
2010-08-06 12:04:12 +00:00
Aleksey Bragin
50a341134c [CDFS]
- MAXIMUM_VOLUME_LABEL_LENGTH is in bytes, not in characters. Fix struct definition and access beyond the buffer. Spotted by Carlo Bramini.
- Trim trailing spaces from the volume label name, instead of stopping at the first encountered space. Fix by Carlo Bramini.
See issue #5505 for more details.

svn path=/trunk/; revision=48468
2010-08-05 21:57:02 +00:00
Aleksey Bragin
cf3a6fe7c5 - Sync ole32 and oleaut32 regtests to Wine-1.3.
svn path=/trunk/; revision=48467
2010-08-05 21:28:34 +00:00
Aleksey Bragin
c2ead94de7 - Sync ole32 and oleaut32 to Wine-1.3.
svn path=/trunk/; revision=48466
2010-08-05 21:19:46 +00:00
Timo Kreuzer
b51cf52307 [SHELL32]
When creating a shortcut icon and we have 32 bpp, use GdiAlphaBlend to create the final bitmap. This is neccessary, since we want to support alpha channels and those are destroyed when using SRCPAINT or any similar ROPs on the alpha bitmap (not a bug, Windows works like that, too). We could use MaskBlt, if it would work correctly, but on reactos it destroys the alpha channel as well (bug!), it's also most likely slower then the current solution.
Fixes broken overlay icons.
See issue #5455 for more details.

svn path=/trunk/; revision=48463
2010-08-05 14:42:56 +00:00
Timo Kreuzer
1eac149580 [WIN32K]
- Copy the alpha channel as well when doing RGB<->BGR color translations.

svn path=/trunk/; revision=48462
2010-08-05 14:32:30 +00:00
Timo Kreuzer
589577fe34 [NTOSKRNL]
- Fixed FsRtlIsNameInExpression to make it properly handle * in expressions
- Fix formatting
- Patch by Pierre Schweitzer
- Fixes everything

See issue #5541 for more details.

svn path=/trunk/; revision=48461
2010-08-05 12:23:23 +00:00
Timo Kreuzer
e715956b80 [KERNEL32]
Fix a check in ContainsPath. Patch by Gabriel Ilardi. 

See issue #5478 for more details.

svn path=/trunk/; revision=48456
2010-08-04 13:33:37 +00:00
Timo Kreuzer
692801bff2 [FASTFAT]
- Fix a check in VfatCreateFile. Patch by Pierre Schweitzer.

See issue #4571 for more details.

svn path=/trunk/; revision=48453
2010-08-04 13:06:47 +00:00
Timo Kreuzer
9fd87c4954 [GDI32]
Fix parameter check in GetTextExtentExPointA/W. Patch by Kamil Hornicek. Fixes bug 5486, bug 5507 and bug 5511

svn path=/trunk/; revision=48446
2010-08-04 00:01:30 +00:00
Timo Kreuzer
e3736b149a Add some tests for GetTextExtentExPoint. Dedicated to Pigglesworth
svn path=/trunk/; revision=48445
2010-08-03 23:15:20 +00:00
Timo Kreuzer
9c9f4cb9e9 [WIN32K]
Protect access to the result pointer from KeUserModeCallback with SEH. Fixes a possible kernel mode crash.

svn path=/trunk/; revision=48437
2010-08-03 21:36:39 +00:00
Aleksey Bragin
f986e82a8d [KERNEL32]
- Sync lcformat.c to Wine-1.3. This fixes (a number of potential) problems introduced by new nls data files being synced recently and led to crashes on locales having different months genitives. Original issue confirmed by Sergey Gusev <evilslon@mail.ru> and Igor Paliychuk.

svn path=/trunk/; revision=48433
2010-08-03 20:23:43 +00:00
Timo Kreuzer
cf02088179 [CRT]
Implement a proper version of _assert. It nows shows a message box with the details and let's the user choose to either abort, debug or ignore the assertion.
See bug 5486, bug 5507, bug 5511

svn path=/trunk/; revision=48432
2010-08-03 16:09:33 +00:00
Cameron Gutman
75f1ada3df [WS2_32]: Fix buffer overrun in getservbyname. Patch by Alexander Yastrebov - menone7 at gmail dot com
svn path=/trunk/; revision=48424
2010-08-02 21:31:50 +00:00
Cameron Gutman
18bc5a24b5 Xcode....
svn path=/trunk/; revision=48423
2010-08-02 21:26:12 +00:00
Cameron Gutman
db0f412b3e [NTOS]: Fix kernel memory corruption when dequeuing a PnP event
svn path=/trunk/; revision=48422
2010-08-02 21:22:34 +00:00
Timo Kreuzer
917fbfd1ea [PSDK]
add missing LPCOLORREF to windef.h

svn path=/trunk/; revision=48414
2010-08-02 14:29:09 +00:00
Cameron Gutman
9088c79a22 There is nothing to say about this...
svn path=/trunk/; revision=48410
2010-08-02 03:52:52 +00:00
Cameron Gutman
caa555a453 [AFD]: BytesAvailable needs to be updated even when peeking so we don't run off the end of our buffer
svn path=/trunk/; revision=48405
2010-08-01 23:52:23 +00:00
Cameron Gutman
a7c693ea78 Forgetting to save really sucks. Sorry again for the wasted commit.
svn path=/trunk/; revision=48404
2010-08-01 23:46:57 +00:00
Cameron Gutman
e98fc993d1 [AFD]: Fix read data corruption when peeking at network data (TDI_RECEIVE_PEEK is specified for a stream socket)
svn path=/trunk/; revision=48403
2010-08-01 23:42:33 +00:00
Cameron Gutman
be40e4a043 Fix a typo
svn path=/trunk/; revision=48402
2010-08-01 23:20:31 +00:00
Cameron Gutman
4e63fd0e5a Fix a copy-paste mistake and remove an unused variable
svn path=/trunk/; revision=48401
2010-08-01 21:08:53 +00:00
Cameron Gutman
14fc97df0c [AFD]: Revert r42674 and part of r47156
svn path=/trunk/; revision=48400
2010-08-01 21:00:40 +00:00
Cameron Gutman
57eed17e05 [DHCPCSVC]: Revert part of r48215
svn path=/trunk/; revision=48399
2010-08-01 20:34:10 +00:00
Giannis Adamopoulos
716e283fb3 [rtl]
- Use __inline instead of __inline__ to fix compilation with msvc

svn path=/trunk/; revision=48398
2010-08-01 16:34:22 +00:00
Giannis Adamopoulos
84d8b7850d [hal]
- define REGISTERCALL in order to replace __attribute__((regparm(3))) and fix compilation with msvc. It was used only as an optimization so it is safe to be defined as FASTCALL for msvc. For gcc it is still defined as __attribute__((regparm(3)))

svn path=/trunk/; revision=48397
2010-08-01 16:27:48 +00:00
Aleksey Bragin
071e036cb8 [INCLUDE/WINE]
- Update Wine-specific headers to Wine-1.3.
- Remove unneeded 16 bit header, and add a bit of stuff into another legacy header.
- Indicate in config.h that there is a freetype library present.

svn path=/trunk/; revision=48388
2010-07-31 22:39:22 +00:00
Aleksey Bragin
9746a25057 [PSDK]
- Make some winuser.h functions conforming to MS PSDK.

svn path=/trunk/; revision=48387
2010-07-31 22:36:22 +00:00
Aleksey Bragin
9d5dfb1c1c - Fix build, sorry.
svn path=/trunk/; revision=48386
2010-07-31 22:20:34 +00:00
Eric Kohl
aacfe3956c [LSASRV]
Add more well known sids to the lookup list.

svn path=/trunk/; revision=48385
2010-07-31 22:02:13 +00:00
Aleksey Bragin
cb3bc802c8 [PSDK]
- Get back to old/compatible way of declaring dummy unions and structs for IMAGE_RESOURCE_DIRECTORY_ENTRY. Also, second nameless structure is called DUMMYSTRUCTNAME3 to be compatible with Wine's code which, for some reason, expects WORD Id wrapped into yet another struct, depending on endiannes.

svn path=/trunk/; revision=48384
2010-07-31 21:40:40 +00:00
Gabriel Ilardi
04dc5e3fce [freeldr]
- Patch by Carlo Bramini reviewed by lassy:
The CF must be tested when reading time because the legacy DS12x87
chip shows a condition where it's updating its time registers and if it's the
case then the call should be retried later. Now the time is valid when both CF flags for date and time are good at the same time.
It's better to send the correct value of CF with the proper field to the REGS structure instead of hoping that the flag won't be changed by compiled code.
In the Int386() function I did the fix for acquiring the status flags to send to the software interrupt.
I also think it is also a good idea to always clear the direction flag before
doing movsb/movsw/movsd in this function. Since we are working with DOS stuff,
the state of the direction register could be unknown, who knows what happens
after those INT opcodes. Afterall I don't think that adding these two "cld"
would be a big problem.
See issue #2786 for more details.

svn path=/trunk/; revision=48383
2010-07-31 21:00:40 +00:00
Giannis Adamopoulos
a5101cce25 [explorer]
- Using msvc doesn't mean using ms sdks

svn path=/trunk/; revision=48381
2010-07-31 12:16:03 +00:00
Aleksey Bragin
74ff3ad0d7 [PSDK]
- Fix GetTextCharsetInfo prototype according to MS Platform SDK.

svn path=/trunk/; revision=48379
2010-07-31 12:02:46 +00:00
Eric Kohl
ad21f9ddae [LSASRV]
- Move all includes into a common header file.
- Create a (still incomplete) well-known-sid lookup table and use it in LsarLookupSids.
- Add missing file headers.

svn path=/trunk/; revision=48378
2010-07-31 11:24:16 +00:00
Eric Kohl
d3111f1e5b [LSASRV]
Replace hard-coded privilege names by privilege names from the PSDK.

svn path=/trunk/; revision=48377
2010-07-31 09:06:42 +00:00
Giannis Adamopoulos
7d1896ae99 [browseui]
- keep the hacky declaration of SHANDLE_PTR and make it work with msvc as well
- Make BEGIN_MSG_MAP compatible with msvc

svn path=/trunk/; revision=48376
2010-07-31 07:53:06 +00:00
Eric Kohl
f271e405f4 [PSDK]
Add missing privilege names.

svn path=/trunk/; revision=48375
2010-07-31 07:09:40 +00:00
Giannis Adamopoulos
8fd2068781 [shell32]
- Fix a compilation error with msvc

svn path=/trunk/; revision=48371
2010-07-30 18:37:51 +00:00
Giannis Adamopoulos
d2a89a0c29 [ndis.h]
- Fix compilation with msvc

svn path=/trunk/; revision=48370
2010-07-30 17:05:17 +00:00
Gabriel Ilardi
395c797826 [TASKMGR]
- Make the caption the same as the app title so that bring to focus can work as expected in Slovak and other languages as well. Add a note for translators. 
See issue #5533 for more details.

svn path=/trunk/; revision=48367
2010-07-29 20:17:09 +00:00
Amine Khaldi
8e9eff5518 [DXSDK]
- Define STATIC_KSMETHODSETID_BdaChangeSync without braces.
[PSDK]
- _ANONYMOUS_UNION/_ANONYMOUS_STRUCT -> __MINGW_EXTENSION
- usbuser.h : Add missing #endif

svn path=/trunk/; revision=48361
2010-07-29 16:42:00 +00:00
Giannis Adamopoulos
dd08ddbbe9 Revert 48355
svn path=/trunk/; revision=48358
2010-07-29 16:05:54 +00:00
Giannis Adamopoulos
101767d1e6 [basetsd.h]
-define SHANDLE_PTR

[browseui]
-do not define SHANDLE_PTR locally. Using ms psdk isn't the same with compiling with msvc

svn path=/trunk/; revision=48355
2010-07-29 14:40:21 +00:00
Giannis Adamopoulos
b3bd25a0cd - Fix setjmp for msvc
svn path=/trunk/; revision=48352
2010-07-29 12:23:03 +00:00
Giannis Adamopoulos
77d4142d6d [win32csr]
- Fix compilation with msvc

svn path=/trunk/; revision=48349
2010-07-29 10:20:41 +00:00
Daniel Reimer
1a92fc2831 Bug 5531: [PATCH] regedit: cut, copy, paste, etc. on hexedit by Katayama Hirofumi
svn path=/trunk/; revision=48334
2010-07-28 19:13:24 +00:00
Amine Khaldi
35efa046d1 [DXSDK]
- atsmedia.h : Add proper header inclusion and apply a consistent formatting.
- bdamedia.h : Rename BDAMEDIA_H__ to _BDAMEDIA_, add some missing inclusions, add __MINGW_EXTENSION and apply a consistent formatting.
- bdatypes.h : Apply a consistent formatting.

svn path=/trunk/; revision=48330
2010-07-28 13:59:28 +00:00
Amine Khaldi
80a061f01c [DXSDK]
- Add some headers to some headers.

svn path=/trunk/; revision=48328
2010-07-28 12:52:04 +00:00
Amine Khaldi
978a651ccf - Delete ppcdevtree.
svn path=/trunk/; revision=48327
2010-07-28 10:45:51 +00:00
Timo Kreuzer
c2fe1ade3c [WIN32CSR]
- Fix array subscript out of bounds error
- Fix a cast

svn path=/trunk/; revision=48322
2010-07-28 01:17:23 +00:00
Timo Kreuzer
055b4d4b12 [NDK]
Merge r41483 from amd64 branch:
- Fix definition of HARDERROR_MSG

svn path=/trunk/; revision=48321
2010-07-28 00:26:43 +00:00
Timo Kreuzer
129a5cbbea [DBGHELP]
Define UNW_FLAG_* in the rbuild file, since we don't have them in winnt.h where wine has them.

svn path=/trunk/; revision=48315
2010-07-27 17:02:06 +00:00
Timo Kreuzer
711796acd9 [GDI32API]
- fix some 64 bit warnings

svn path=/trunk/; revision=48314
2010-07-27 16:24:31 +00:00
Timo Kreuzer
0739761488 [FREELDR]
Don't redefine _NTSYSTEM_

svn path=/trunk/; revision=48313
2010-07-27 16:21:20 +00:00
Timo Kreuzer
59b1059723 [BATTC]
Fix a warning

svn path=/trunk/; revision=48312
2010-07-27 16:09:15 +00:00
Timo Kreuzer
eba4c7f302 [winnt.h]
Remove definition of UNW_FLAG* constants. They don't belong here.

svn path=/trunk/; revision=48308
2010-07-27 15:58:53 +00:00
Timo Kreuzer
32c8cb0448 [UNICODE]
include string.h, for memcpy

svn path=/trunk/; revision=48307
2010-07-27 15:47:04 +00:00
Timo Kreuzer
64cf51962c [dbghelp.h] / [imagehlp.h]
- fix LOADED_IMAGE, UpdateDebugInfoFile, UpdateDebugInfoFileEx, ReBaseImage

svn path=/trunk/; revision=48306
2010-07-27 14:08:36 +00:00
Amine Khaldi
ff9c2c0033 [PSDK]
- Mark TraceMessageVa as WMIAPI.

svn path=/trunk/; revision=48300
2010-07-27 09:56:21 +00:00
Amine Khaldi
012c09c954 [XDK]
- WmiTraceMessageVa is NTAPI, not __cdecl.
[DDK]
- Update wdm.h to reflect XDK changes.

svn path=/trunk/; revision=48299
2010-07-27 09:14:13 +00:00
evb
bf7de6528b Add all pci bridge control function (PciBridgeIoBase, PciBridgeIoLimit, PciBridgeMemoryBase, PciBridgeMemoryLimit, PciBridgePrefetchMemoryBase, PciBridgePrefetchMemoryLimit, PciBridgeMemoryWorstCasealignment, PciBridgeIsPositiveDecode, PciBridgeIsSubtractiveDecode)
More support ICH0/1/2/3/4 hub
Add all PCI2PCI bridge limit/current resource codes (PPBridge_*), now is BAR setup okay, and Device_* must be implement
Support ISA+VGA legacy decode, 20+64-bit decode, ROM BAR, prefetch BAR

svn path=/trunk/; revision=48298
2010-07-27 03:24:24 +00:00
Daniel Reimer
8458508701 Maybe fix dbghelp build on 64 bit.
svn path=/trunk/; revision=48292
2010-07-26 23:48:15 +00:00
Timo Kreuzer
ac342cea5f [NTOSKRNL]
◙ Fix MiInitializePageTable
◙ Comment out some more code for amd64

svn path=/trunk/; revision=48291
2010-07-26 23:09:17 +00:00
Daniel Reimer
7d17455cc4 Sync dbghelp and imagehlp to Wine 1.2
Winhttp and Wininet don't like me and so I skip them for now.

svn path=/trunk/; revision=48290
2010-07-26 22:33:59 +00:00
Giannis Adamopoulos
e3b6d0cea7 Revert a part of my previous commit
svn path=/trunk/; revision=48289
2010-07-26 21:48:52 +00:00
Sir Richard
a9fb81cbae [NTOS]: Another long-lost-promised straggler for Timo. There may be more of these needed, this is what I had done on my disk.
svn path=/trunk/; revision=48288
2010-07-26 21:45:42 +00:00
Giannis Adamopoulos
91f37cae9a [ntos]
- Fix several issues with msvc in ntoskrnl
- Add ATTRIB_NORETURN definition which will be used by function pointers because msvc doesn't like DECLSPEC_NORETURN in function pointers

svn path=/trunk/; revision=48287
2010-07-26 21:32:38 +00:00
Daniel Reimer
f126b1d282 Sync winemp3.acm with Wine HEAD. This one uses libmpg123 which was added in Version 1.12.3. Thx to Timo Kreuzer for telling me the magics of the crt="dll" switch.
svn path=/trunk/; revision=48279
2010-07-26 15:04:32 +00:00
Timo Kreuzer
deaaddddb6 [reactos.dff]
make explorer.exe and ntvdm optional

svn path=/trunk/; revision=48278
2010-07-26 14:01:57 +00:00
Amine Khaldi
6e64b7602b [PSDK]
- Rename _WINIOCTL_H to _WINIOCTL_

svn path=/trunk/; revision=48277
2010-07-26 13:49:12 +00:00
Timo Kreuzer
79de2377a7 Add hivecls_amd64.inf
svn path=/trunk/; revision=48276
2010-07-26 13:43:40 +00:00
Sylvain Petreolle
602ffa4c9a Add diffs for msimtf and atl.
svn path=/trunk/; revision=48275
2010-07-26 09:13:50 +00:00
Pierre Schweitzer
41c67f722a Get back r47063 & r47960 reverted by r48273
svn path=/trunk/; revision=48274
2010-07-26 08:54:26 +00:00
Daniel Reimer
6170959bce Finish the Wine sync. These components are not just rc file changes
atl, comctl32, comdlg32, dwmapi, fusion, gdiplus, jscript, mpr, mshtml, msi, msimtf, msxml3, ole32, oleaut32, riched20, shdocvw, shlwapi, urlmon, usp10, version and windowscodecs
Seems to build and boot. /me hides

svn path=/trunk/; revision=48273
2010-07-26 02:26:04 +00:00
Timo Kreuzer
032f133284 Add amd64 inf files
svn path=/trunk/; revision=48272
2010-07-26 01:42:31 +00:00
Timo Kreuzer
0e58e11548 [CRT]
Add logf wrapper

svn path=/trunk/; revision=48271
2010-07-26 01:10:20 +00:00
Daniel Reimer
8a3289ed5c Wine dll sync commit 1 of 2.
This one syncs all dlls which only have resource file changes.
avifil32, credui, crypt32, cryptdlg, cryptui, iccvid, kernel32, localspl, localui, mapi32, msacm32, msrle32, msvfw32, msvidc32, oleacc, oledlg, pstorec, shdoclc, wldap32

svn path=/trunk/; revision=48269
2010-07-26 00:12:22 +00:00
Timo Kreuzer
1c9a033a6c [MSVCRT]
Add exports for ceilf, cosf, logf

svn path=/trunk/; revision=48265
2010-07-25 21:58:08 +00:00
Sylvain Petreolle
949283de1e [TOUCH]
Remove ntdll library and link to getopt.

svn path=/trunk/; revision=48263
2010-07-25 20:57:38 +00:00
Amine Khaldi
d713d0e533 Ukrainian translation patch for taskmgr, explorer and shell32. By Igor Paliychuk.
svn path=/trunk/; revision=48254
2010-07-25 16:15:27 +00:00
Amine Khaldi
79fc59a054 Fix build.
svn path=/trunk/; revision=48253
2010-07-25 14:20:03 +00:00
Timo Kreuzer
461b4ab969 [NEWINFLIB]
PINT -> INT*

svn path=/trunk/; revision=48252
2010-07-25 14:09:08 +00:00
Timo Kreuzer
371d1d1546 [USETUP] / [INFLIB]
Merge r36443 from amd64 branch:
Remove references to Infp Functions that collide with inflib names, call the actual functions instead of making small functions that shared the same parameters and just called into inflib anyway, with no changes whatsoever.
Make InfpGetIntField's 3rd parameter an INT* (Samuel Serapion)

svn path=/trunk/; revision=48251
2010-07-25 13:46:54 +00:00
Timo Kreuzer
b2b385e9a8 [OSKITTCP]
Don't add leading underscores to symbols on amd64 builds

svn path=/trunk/; revision=48250
2010-07-25 12:34:56 +00:00
Timo Kreuzer
592b4de3ba [NTOSKRNL]
- Fix MiAddressToPti and implement MiAddressToPxi for amd64
- Replace #error with DPRINT and ASSERT(FALSE) in MiInitializeLargePageSupport
- Implement amd64 specific MmCreateProcessAddressSpace
- Add MmProtectToPteMask for amd64 (copied from x86)
- Remove amd64 version of MmInitializeHandBuiltProcess

svn path=/trunk/; revision=48249
2010-07-25 12:00:26 +00:00
Timo Kreuzer
2d50d1e044 [MINGW]
Add a temporary hack to fix amd64 compilation for some modules.

svn path=/trunk/; revision=48241
2010-07-25 03:08:53 +00:00
Cameron Gutman
d1cca9ae42 [IPCONFIG]
- Fix the media detection code in ipconfig

svn path=/trunk/; revision=48240
2010-07-25 03:02:01 +00:00
Amine Khaldi
fbdc7009aa [PSDK]
- Make FORCEINLINE extern (not static)
- Declare WspiapiLegacyFreeAddrInfo, WspiapiLegacyGetAddrInfo and WspiapiLegacyGetNameInfo as static __inline.
[CRT]
- Convert FillBuf to static __inline.
[NTOS]
- Convert MmProtectToPteMask to extern.
- Convert LpcpAllocateFromPortZone to static __inline.

svn path=/trunk/; revision=48239
2010-07-25 01:22:15 +00:00
Timo Kreuzer
0bbdcf4d8b [NTOSKRNL]
Make MmIsAddressValid portable by using _MI_PAGING_LEVELS macro.

svn path=/trunk/; revision=48238
2010-07-25 00:50:03 +00:00
Sir Richard
a28e798006 [NTOS]: Implement MmDeleteTeb, VADs are now deleted/freed on thread exit as well (but the underlying page is still leaked). Should fix the advapi32 security crash.
[NTOS]: Sometimes it seems we hit some bad VADs due to bugs? in the AVL tree implementation. I'm going on vacation for a month and can't look at this, so I've hacked the code to ignore such VADs for now, in the interest of fixing the winetest regression.

svn path=/trunk/; revision=48235
2010-07-24 16:28:51 +00:00
Sir Richard
2384532846 [NTOS]: Implement MmCleanProcessAddressSpace in ARM3, now the PEB/TEB VADs are removed when the process exits (although the pages are still leaking, for now), and the pool allocation for the VAD is also freed.
[NTOS]: Use ARM3 paged pool up until smss.exe starts. There's a last bug in the expansion code before we can get rid of the old paged pool.

svn path=/trunk/; revision=48234
2010-07-24 16:12:39 +00:00
Sir Richard
3ec9a11a16 [NTOS]: Reimplement MmCreateProcessAddressSpace in ARM3. Basically the same as before but using the ARM3 PFN list APIs, the ARM3 macros, etc. Once change is processes are now populating the MmProcessList, and the "MmGlobalKernelPageTable" isn't used anymore for new processes. Also the mappings come from SysPTE space, not hyperspace.
[NTOS]: More work will be needed in this area, but this gets rid of another ReactOS dinosaur.

svn path=/trunk/; revision=48233
2010-07-24 15:30:24 +00:00
Cameron Gutman
ecd26cf41a [DHCPCSVC]
- Initialize length to prevent a possible buffer overflow
- Thanks to janderwald for finding my mistake

svn path=/trunk/; revision=48232
2010-07-24 15:04:24 +00:00
Sir Richard
7ea7b76e51 [NTOS]: Take over MmInitializeProcessAddressSpace, MmInitializeHandBuiltProcess, MmInitializeHandBuiltProcess2 into ARM3, and cleanup the code.
[NTOS]: Prepare to take over MmCreateProcessAddressSpace.

svn path=/trunk/; revision=48231
2010-07-24 15:01:05 +00:00
Amine Khaldi
3bb2ea0d09 [KMIXER]
- Remove memset and memcpy implementations from pin.c

svn path=/trunk/; revision=48230
2010-07-24 14:49:46 +00:00
Amine Khaldi
e297cfa306 [NDIS]
- Move NDIS_HARDWARE_STATUS, GEN_GET_TIME_CAPS, GEN_GET_NETCARD_TIME, NDIS_MEDIA_STATE, NDIS_GUID, NDIS_PM_PACKET_PATTERN, NETWORK_ADDRESS, NETWORK_ADDRESS_LIST, TRANSPORT_HEADER_OFFSET and NDIS_CO_LINK_SPEED from ndis.h to ntddndis.h (where they should belong).
- typedef NDIS_STATUS for ntddndis.h
- Group some related definitions in ndis.h
- Some _ANONYMOUS_* -> __MINGW_EXTENSION conversions.
- Guard some definitions against NDIS_LEGACY_DRIVER.
- Add some missing definitions.
- NDIS_MINIPORT_BLOCK : PVOID  Signature; -> NDIS_OBJECT_HEADER Header;
- Add missing xfilter.h inclusion.
- Add some missing function declarations.
- Convert some function declarations into macros.
- Guard some definitions against NDIS_LEGACY_MINIPORT.

svn path=/trunk/; revision=48229
2010-07-24 13:47:41 +00:00
Amine Khaldi
39cec38832 [XDK]
- Missed this one (FORCEINLINE)
[DDK]
- Update DDK to reflect the XDK changes.

svn path=/trunk/; revision=48228
2010-07-24 10:51:22 +00:00
Amine Khaldi
e1e0ed63e2 [[MINGW-W64]
- Tighten up reactos.diff now that we have all those diffs (except one) committed upstream.

svn path=/trunk/; revision=48227
2010-07-24 10:10:15 +00:00
Amine Khaldi
0e192aab81 [MINGW-W64]
- Sync gs_support.c now that our patches are committed upstream.

svn path=/trunk/; revision=48226
2010-07-24 09:59:34 +00:00
Amine Khaldi
e7cebee706 [CRT]
- Add __MINGW_ATTRIB_UNUSED macro.

svn path=/trunk/; revision=48225
2010-07-24 09:52:46 +00:00
Amine Khaldi
74f12eeaf7 [XDK]
- Make sure FORCEINLINE comes as first in declarations.
[DDK]
- Update DDK to reflect the XDK changes.

svn path=/trunk/; revision=48224
2010-07-24 09:20:56 +00:00
Sir Richard
be9e04b5cb [NTOS]: Implement an AVL node deletion algorithm (RtlpDeleteAvlTreeNode). Use it in MiRemoveNode, now implemeneted, and RtlDeleteElementGenericTableAvl, also now implemented. It hopefully works.
svn path=/trunk/; revision=48223
2010-07-24 04:00:22 +00:00
Timo Kreuzer
bfc2638590 [NTOSKRNL]
Bring over all current amd64 specific code from the amd64 branch

svn path=/trunk/; revision=48222
2010-07-24 01:12:13 +00:00
Cameron Gutman
869cdbce37 - Fix epic naming fail (DhcpEnabled -> EnableDHCP
[DHCPCSVC]: Verify that the length is correct
[TCPIP]: Make sure DHCP is enabled before reading IP information

svn path=/trunk/; revision=48221
2010-07-24 00:25:59 +00:00
Timo Kreuzer
66b4c2ff3e [NTOSKRNL]
Add missing declarations

svn path=/trunk/; revision=48220
2010-07-23 23:50:26 +00:00
Timo Kreuzer
19540dcad5 [NTOSKRNL]
- Add KiGetLinkedTrapFrame for amd64
- Add MiAddressToPti
- Fix MmCreateProcessAddressSpace, MmInitializeHandBuiltProcess prototype (ULONG -> ULONG_PTR)
- #if out some C_ASSERTs for other architectures than x86
- #define InitializeSListHead to RtlInitializeSListHead on amd64
- Don't implement MiSyncARM3WithROS on amd64
- Implement RtlPcToFileHeader, RtlpGetStackLimits

svn path=/trunk/; revision=48219
2010-07-23 23:30:00 +00:00
Timo Kreuzer
c168961990 [NDK]
Update amd64/asm.h to MSVC compatible format

svn path=/trunk/; revision=48218
2010-07-23 23:23:51 +00:00
Timo Kreuzer
56f8b1717a [NTOSKRNL]
Don't use freeldrhack on amd64

svn path=/trunk/; revision=48217
2010-07-23 22:40:13 +00:00
Cameron Gutman
59081046c2 - Remove some debug info that I forgot about
svn path=/trunk/; revision=48216
2010-07-23 22:33:09 +00:00
Cameron Gutman
63dfd0ccaa [NETCFGX]
- Create the DhcpEnabled value in the registry
[TCPIP]
- Apply the static IP address configuration data
[DHCPCSVC]
- Remove the static IP address code

svn path=/trunk/; revision=48215
2010-07-23 22:30:27 +00:00
Cameron Gutman
00e8981795 [DHCPCSVC]
- Generate a link-local IP address if DHCP fails
- Don't destroy the IP addresses in the registry

svn path=/trunk/; revision=48213
2010-07-23 21:57:08 +00:00
Cameron Gutman
3d5cb94c4a [NDIS]
- Verify that each adapter has been initialized before passing it to the protocol's BindAdapter function
- Also verify that each adapter has not already been bound to the protocol
- Miniport drivers can now function without a reboot (needed to use 3rd-party NIC drivers on the live CD)

svn path=/trunk/; revision=48212
2010-07-23 16:34:35 +00:00
Amine Khaldi
e814e6afe8 [NDIS]
- Guard several definitions against NDIS_SUPPORT_60_COMPATIBLE_API.
- __GNU_EXTENSION -> __MINGW_EXTENSION conversions.
- Group some related definitions.
- Update NDIS_RW_LOCK.
- Improve NDIS_TIMER_FUNCTION.
- Add several missing Ndis* function declarations.
- Guard several definitions against NDIS_LEGACY_DRIVER and NDIS_LEGACY_MINIPORT.
- Convert some function declarations into macros.

svn path=/trunk/; revision=48211
2010-07-23 15:51:54 +00:00
Daniel Reimer
87b3292e96 Sync reg, xcopy, winhlp32, wordpad with Wine 1.2
svn path=/trunk/; revision=48210
2010-07-23 08:36:51 +00:00
Daniel Reimer
1048fa4974 Sync Winefile with Wine 1.2
svn path=/trunk/; revision=48209
2010-07-23 08:34:57 +00:00
Timo Kreuzer
88499392ee [PSEH]
Stub amd64 functions and remove leading underscores from symbols

svn path=/trunk/; revision=48207
2010-07-23 02:18:30 +00:00
Timo Kreuzer
66365c895c [PSEH]
Add (non working) 64bit code

svn path=/trunk/; revision=48206
2010-07-23 01:36:44 +00:00
Amine Khaldi
2aa6e09c17 [NDIS]
- Convert NDIS_ERROR_CODE from a typedef to a define.
- Add some missing NDIS_STATUS_* definitions.
- Some _ANONYMOUS_UNION/_ANONYMOUS_STRUCT/__GNU_EXTENSION -> __MINGW_EXTENSION conversions.
- Update NDIS_REQUEST_TYPE and NDIS_PER_PACKET_INFO.
- Guard several definitions against NDIS_LEGACY_DRIVER.
- Improve NDIS_REQUEST.
- Add missing CO_ADDRESS_FAMILY_INFINIBAND, Ndis{Set,Get}PacketCancelId, NDIS_PACKET_{FIRST,LAST}_NDIS_BUFFER and NDIS_PACKET_VALID_COUNTS.
- Group related definitions.
- Update several Ndis* function declarations.
- Add missing NdisInterlocked{Push,Pop}EntryList and NdisGetCurrentSystemTime macros.

svn path=/trunk/; revision=48205
2010-07-23 00:20:13 +00:00
Timo Kreuzer
7feaf99fb1 [NTOSKRNL]
- Add some missing constants for amd64
- Fix compilation of kd64
- Make MmAllocationFragment a SIZE_T

svn path=/trunk/; revision=48204
2010-07-22 23:22:57 +00:00
Daniel Reimer
60082fb243 Update FireFox, KDE, MirandaIM, Mono, Opera, RosBE64, SeaMonkey, ThunderBird, uTorrent, VLC in rapps.
svn path=/trunk/; revision=48203
2010-07-22 22:01:58 +00:00
Sir Richard
89acc3113a [NTOS]: Stop creating a memory area for the shared user data page.
[NTOS]: Also stop creating a memory area for the illegal user-mode parts of address space.
[NTOS]: Instead, mark the area between MM_HIGHEST_VAD_ADDRESS and MM_HIGHEST_USER_ADDRESS as being ARM3 as well: this way, ARM3 will get the illegal access (and fault), and it will also get the shared user data page access.
[NTOS]: With the previous commit, ARM3 knows how to handle the shared user data page access, and does so succesfully. End result: two more MAREA types have been removed, and the address space setup code is now much simpler.

svn path=/trunk/; revision=48202
2010-07-22 20:54:37 +00:00
Sir Richard
da305551a9 Note: this patch only implements the code paths, they are not excercised yet.
[NTOS]: Implement handling a very special case of "prototype PTE", the one used to map the shared user data for user-mode applications.
[NTOS]: MiCheckVirtualAddress detects this (Windows behavior) and returns a prototype PTE that's marked MM_READONLY. This is our MmSharedUserDataPte from before. This gets sent to MiDispatchFault which calls MiResolveProtoPteFault to handle it. In turn, this calls MiCompleteProtoPteFault. All these code paths have heavy ASSERTions to only allow them to be hit for the shared user data page, however, in the far distant future when prototype PTEs are used for section objects, we'll at least have the right checks and code flow (many of these ASSERTions will then have to be removed).
[NTOS]: The end result is that we also now have STATUS_PAGE_FAULT_TRANSITION, not just STATUS_PAGE_FAULT_DEMAND_ZERO, and that prototype PTEs are somewhat understood and some assumptions have been removed.

svn path=/trunk/; revision=48201
2010-07-22 20:52:23 +00:00
Sir Richard
dd68882cd0 [NTOS]: Stop handling PEB/TEB MAREAs since they're not used anymore.
svn path=/trunk/; revision=48200
2010-07-22 20:48:04 +00:00
Sir Richard
9e489a9b8e [NTOS]: Define the template prototype PTE.
svn path=/trunk/; revision=48199
2010-07-22 20:47:28 +00:00
Sir Richard
155c1e701b [NTOS]: Stop handling a bunch of MEMORY_AREA_TYPEs that aren't used anymore.
svn path=/trunk/; revision=48198
2010-07-22 20:46:49 +00:00
Sir Richard
f907eeb4f9 [NTOS]: Antique leftover, initialize the shared user data page with MI_MAKE_HARDWARE_PTE_KERNEL
svn path=/trunk/; revision=48197
2010-07-22 20:46:19 +00:00
Cameron Gutman
cee7a2a71e [DHCPCSVC]
- Add a hack so we wait for TCP/IP to get ready and bind to adapters instead of failing immediately after the first probe
- Live CD and 2nd stage setup now have fully functional networking :)

svn path=/trunk/; revision=48195
2010-07-22 19:37:33 +00:00
Sir Richard
128fd3ca92 [NTOS]: Allocate the PEB at a pseudo-random address just like Windows XP SP2 and later, to prevent certain kinds of exploits.
[NTOS]: Allocate PEB and TEB using VADs! The user-mode fault handler seems to work fine, and I could find no regressions. This is the beginning of the end for MAREAs for VM allocations (they will remain for sections).

svn path=/trunk/; revision=48194
2010-07-22 19:08:45 +00:00
Cameron Gutman
92d6d7210c [NDIS]
- Refresh the protocol bindings after a new miniport is added
- Adapters added after boot work now
- One step closer to Live CD networking

svn path=/trunk/; revision=48193
2010-07-22 19:01:49 +00:00
Sir Richard
135986ec2e [NTOS]: To Timo, with Love (make System PTEs work on x64).
svn path=/trunk/; revision=48192
2010-07-22 18:55:36 +00:00
Sir Richard
7fa909a601 [NTOS]: Add support for handling a very specific type of user-fault on ARM3 memory: memory belonging to a VAD allocation made for a PEB/TEB (read-write) that hasn't yet been allocated.
[NTOS]: Define the demand-zero PDE template.

svn path=/trunk/; revision=48190
2010-07-22 18:37:27 +00:00
Cameron Gutman
9a28440154 [NETCFGX]
- Start the TCP/IP driver after we install a network adapter
- This fixes the major bug that blocks Live CD networking but we still have some DHCP issues (DHCP starts and fails before the NIC and TCP/IP has been installed) and some other adapter detection issues that I need to look into but this is a good first step

svn path=/trunk/; revision=48188
2010-07-22 18:29:35 +00:00
Sir Richard
23c3e742d9 [NTOS]: Fix a very stupid bug which made any machine with less than 52GB of RAM appear as a "Small memory machine" (instead of 13MB).
[NTOS]: Initialize MmTotalCommitLimit, MmTotalCommitLimitMaximum for consistency.
[NTOS]: Initialize and honor MmAllocationFragment value from registry, or from defaults.
[NTOS]: Initialize the system cache working set pushlock.
[NTOS]: Implement Mi(Un)Lock(Process)WorkingSet inlines to handle the various scenarios. Replace broken/hacky code that was in the system loader, fault handler, and VM deletion paths with the correct macros. No locking is done yet as ReactOS' MAREA implementation overloads the Vm field in EPROCESS, but the correct APC blockings and state transitions are done.
[NTOS]: Add another helper from symbols, MI_IS_PAGE_TABLE_OR_HYPER_ADDRESS, and use it instead of the math-by-hand.
[NTOS]: Add MM_IS_ANY_LOCK_HELD and MI_WS_OWNER to help out the new working let locking inlines (names taken from symbols).
[NTOS]: Add _1GB helper for large-memory checks. Also define _1KB as "1024u". The "u" makes GCC not complain when sizes reach >= 2GB, because GCC will interpret the integer literals as "signed", even if the final calculated value is in an unsigned variable.

svn path=/trunk/; revision=48187
2010-07-22 18:26:04 +00:00
Timo Kreuzer
4ae7219e5c [NDK]
Include the correct mmtypes.h for amd64

svn path=/trunk/; revision=48186
2010-07-22 15:18:55 +00:00
Timo Kreuzer
6c1aa302b3 [NTDLL]
- Add amd64 stubs for LdrInitializeThunk and KiUserApcDispatcher

svn path=/trunk/; revision=48185
2010-07-22 14:49:42 +00:00
Timo Kreuzer
5544c14ffb [NTDLL]
- Comment out RtlWalkFrameChain for amd64

svn path=/trunk/; revision=48184
2010-07-22 14:44:27 +00:00
Timo Kreuzer
3c4ff1e189 [MSVCRT]
- export _ftol only on i386
- fix _setjmp (2nd argument) and redirect setjmp

svn path=/trunk/; revision=48183
2010-07-22 10:23:52 +00:00
Timo Kreuzer
ecc9ac8278 [TLIST]
link to getopt library

svn path=/trunk/; revision=48182
2010-07-22 09:20:35 +00:00
Timo Kreuzer
ca9e196050 [MINGW]
- Remove getopt from mingw lib and put it into it's own static library
- change crt="dll" to crt="static" for the mingw startup libs, to avoid things like importing from itself.

svn path=/trunk/; revision=48181
2010-07-22 09:20:03 +00:00
Sir Richard
ba1b8c6dad [NTOS]: Fix "fail". Dedicated to Timo.
svn path=/trunk/; revision=48180
2010-07-22 05:22:26 +00:00
Timo Kreuzer
3ea611401e [NTOSKRL]
Add missing MI_LOWEST_VAD_ADDRESS for amd64

svn path=/trunk/; revision=48179
2010-07-22 04:19:27 +00:00
Timo Kreuzer
541d2436cd [NDK]
Fix MMADDRESS_NODE and MM_AVL_TABLE

svn path=/trunk/; revision=48178
2010-07-22 04:08:57 +00:00
Timo Kreuzer
5dd4d18e01 [FREELDR]
- In the fat bootsector, don't clobber ax, it contains the number of first cluster of freeldr.sys and is used by the fathelper code.
- Fix jump code in the fathelper code, like in the other bootsectors.
- Now booting from fat partitions (looks like that's what sysreg does) works again. It's safe under the condition that the cluster size is at least 4352 bytes, which is true for harddisks of sizes bigger than 272MB. Booting from smaller fat disks, like floppy breaks when freeldr.sys gets fragmented, which should rarely happen.

svn path=/trunk/; revision=48177
2010-07-22 03:29:25 +00:00
Sir Richard
c30930d3ec [NTOS]: MiRosTakeOverPebTebRanges now creates a small ~1MB ARM3 memory range on top of the ReactOS per-process VA. This does a couple of things: First of all, it changes the default PEB address to another static address. Still not dynamic like it will be soon, but at least it changes it a bit so we can test if anything breaks due to that. It also likewise changes the addresses of the TEBs (Shifted down by 1MB, basically). Finally, it blocks off that part of address space, which nobody should be using now, to see if anyone does indeed touch it.
[NTOS]: Knowing if this change causes issues will help later in determining regressions due to TEB/PEBs mapped as VADs by ARM3, and regressions simply due to the change in VA layout.
[NTOS]: When implemented, the VAD mapping for PEB/TEB will only use that ~1MB, which yes, will limit ReactOS processes to each have only 256 threads. That is obviously a temporary limitation, one I doubt we'll even hit, but I'm putting it out here so you know.

svn path=/trunk/; revision=48176
2010-07-22 03:22:43 +00:00
Sir Richard
d403f0ffd4 [NTOS]: Learn to build User PTEs as well, with MI_MAKE_HARDWARE_PTE_USER.
[NTOS]: MI_MAKE_HARDWARE_PTE becomes MI_MAKE_HARDWARE_PTE_KERNEL, since it assumed this. MI_MAKE_HARDWARE_PTE is now a "generic" you can use when you don't know what the PTE should be. It uses MiDetermineUserGlobalMask to set the right bits.
[NTOS]: Add two more helpers: MI_IS_PAGE_TABLE_ADDRESS and MI_IS_SYSTEM_PAGE_TABLE_ADDDRESS. One is in the symbols, the other I made up to make things clearer.
[NTOS]: MiResolveDemandZeroFault now knnows how to resolve user-demand-zero-faults.
[NTOS]: Implement MiZeroPfn to do the actual zeroing during user-demand-zero-faults (also later for VAD faults).

svn path=/trunk/; revision=48175
2010-07-22 02:20:27 +00:00
Sir Richard
7c3bc09fa1 [NTOS]: Add missing definitions, should fix build.
svn path=/trunk/; revision=48174
2010-07-22 02:10:43 +00:00
Sir Richard
40e4bc04b5 This patch introduces a highly-shareable version of AVL trees both for RTL usage and for ARM3's MM_AVL_TABLE/MMADDRESS_NODE structures used by VADs on Windows (and soon, ReactOS):
[RTL]: Uncouple generic table from AVL table implementation into its own avltable.c
[RTL]: Get rid of "Austin" and fix prototypes of AVL table functions.
[RTL]: Re-implement AVL table functions, sharing as much code as possible with the SPLAY tree implementation which is pretty decent. Lookup, insert, enumeration are implemented, but not delete.
[RTL]: Make large part of the RTL AVL package into its own "support" file that can work both with MMADDRESS_NODE and RTL_BALANCED_LINKS structures. The former is used by ARM3 for VADs.
[NTOS]: Implement basic VAD AVL tree routines (Insert, LookupEmpty, GetPrevious, CheckForConflict, Locate). This is enough to insert VADs, find a free address range, and locate a VAD by address. No delete yet
Thanks to Timo Kreuzer for some clever definitions, Knuth for his genius, several online C implementations for ideas, the HPI kernel blog for insight on how Windows does it, and others.

svn path=/trunk/; revision=48173
2010-07-22 01:41:45 +00:00
Sir Richard
23e18538f1 [NDK]: Add all the definitions regarding VADs.
svn path=/trunk/; revision=48172
2010-07-22 01:41:20 +00:00
Sir Richard
1ceb6d5850 [NDK]: Add missing RTL AVL Tree definitions, when used by user-mode applications.
svn path=/trunk/; revision=48171
2010-07-22 01:09:43 +00:00
Amine Khaldi
94896e3157 [PSDK]
- Forgot to commit this.

svn path=/trunk/; revision=48170
2010-07-21 23:47:33 +00:00
Amine Khaldi
281e92894d [DDK/NDIS]
- Group some related definitions.
- Remove some duplicated NDIS_MINIPORT_MAJOR_VERSION/NDIS_MINIPORT_MINOR_VERSION combinations.
- Add some missing NDIS_LEGACY_DRIVER guards.
- _ANONYMOUS_UNION -> __MINGW_EXTENSION
- Update NDIS_PROCESSOR_TYPE and NDIS_INTERFACE_TYPE.
- Guard NDIS_GENERIC_OBJECT with NDIS_SUPPORT_NDIS6.
- Add missing NDIS_WAN_GET_STATS, NdisAllocateGenericObject, NdisFreeGenericObject, fPACKET_WRAPPER_RESERVED and NDIS_FLAGS_* definitions.
- PNDIS_PACKET_POOL : HANDLE -> NDIS_HANDLE.
- Improve MEDIA_SPECIFIC_INFORMATION
- Some minor formatting.

svn path=/trunk/; revision=48169
2010-07-21 23:32:51 +00:00
Timo Kreuzer
b03d6b06cd [RBUILD]
Generate an RSP rule for the bootloader, this fixes "input line too long" error reported by tower.

svn path=/trunk/; revision=48168
2010-07-21 23:17:12 +00:00
Jérôme Gardou
efc09eb443 update README.WINE
svn path=/trunk/; revision=48167
2010-07-21 21:28:31 +00:00
Amine Khaldi
ec46e3cec9 [DDK/NDIS]
- Add missing ntstatus.h inclusion.
- Group some related definitions.
- Add several missing ones.

svn path=/trunk/; revision=48165
2010-07-21 19:12:14 +00:00
Sir Richard
f9444f0c52 [NTOS]: Handle faults on user-mode addresses, from user-mode processes, if they are owned by ARM3, so they can be forwarded to the VAD fault handler.
svn path=/trunk/; revision=48164
2010-07-21 18:09:31 +00:00
Sir Richard
e6cdd4d0fd [NTOS]: If the memory area is owned by ARM3, and it's being freed, don't touch the pages, just unlink it and free the memory. This is useful for MAREAs being used by ARM3 to protect pieces of address space from the Ros Mm Allocator, but when we don't want it to start playing with our pages. When we do free those MAREAs, keep it away!
svn path=/trunk/; revision=48163
2010-07-21 17:58:09 +00:00
Amine Khaldi
ce8b9f4fcb [CRT]
- Improve NULL definition.

svn path=/trunk/; revision=48162
2010-07-21 17:26:00 +00:00
Timo Kreuzer
f0daba18dd [CRT]
- Add a number of amd64 specific math functions
- add generic c versions of cos and sin
- Remove leading underscores from amd64 symbols

svn path=/trunk/; revision=48161
2010-07-21 16:03:44 +00:00
Timo Kreuzer
6c98c1057f [GDIPLUS]
On amd64 builds link gdiplus to crt

svn path=/trunk/; revision=48160
2010-07-21 15:55:51 +00:00
Gabriel Ilardi
11a32bcc42 [DESK]
- Implement theme quick preview. Patch by Katayama Hirofumi.

See issue #5525 for more details.

svn path=/trunk/; revision=48159
2010-07-21 12:20:18 +00:00
Timo Kreuzer
8d8f884623 [MINGW]
Remove broken _fmode declaration

svn path=/trunk/; revision=48158
2010-07-21 03:22:27 +00:00
Timo Kreuzer
147a7b6fc9 [stdlib.h]
- Improve definition of __mb_cur_max and related
- properly handle _M_CEE_PURE

svn path=/trunk/; revision=48157
2010-07-21 02:55:59 +00:00
Timo Kreuzer
398f20dacd [NTDLL]
Add _setjmp, _setjmpex and longjmp exports on amd64

svn path=/trunk/; revision=48156
2010-07-21 02:53:24 +00:00
Timo Kreuzer
240c411b7d [RSYM64]
Silence annoying error messages

svn path=/trunk/; revision=48155
2010-07-21 02:52:37 +00:00
Timo Kreuzer
0b2826db83 [MINGW]
link mingw_common to oldnames and ntdll

svn path=/trunk/; revision=48154
2010-07-21 02:04:49 +00:00
Timo Kreuzer
0bb23409ed [ATAPI]
Link to libcntpr to resolve memmove

svn path=/trunk/; revision=48153
2010-07-21 01:07:19 +00:00
Timo Kreuzer
d7f170a4ee [setjmp.h]
Add mingw_getsp as inline function

svn path=/trunk/; revision=48152
2010-07-21 00:31:14 +00:00
Timo Kreuzer
0711c75539 [CRT]
- Add amd64 versions of setjmp / longjmp
- Add amd64 versions of chkstk_asm.s, seh.s to libcntpr

svn path=/trunk/; revision=48151
2010-07-21 00:26:51 +00:00
Timo Kreuzer
d7e775596d [FREELDR]
- Unify rbuild rule for freeldr, except for ppc, which uses elfexecutable

svn path=/trunk/; revision=48149
2010-07-20 21:38:58 +00:00
Timo Kreuzer
6e137a3c50 [BZIP2]
- remove hal from libs
- convert to spec

svn path=/trunk/; revision=48148
2010-07-20 21:29:48 +00:00
Eric Kohl
924ee8d9ef [FORMATTING]
No code changes.

svn path=/trunk/; revision=48146
2010-07-20 20:48:11 +00:00
Timo Kreuzer
a9b1042fdf [NTOSKRNL/FREELDR]
Add amd64 linker scripts

svn path=/trunk/; revision=48144
2010-07-20 19:38:22 +00:00
Amine Khaldi
3f25e73244 [MINGW-W64]
- Wrap MSVC intrinsics onto GCC builtins.
- Mark 'cookie' as an __UNUSED_PARAM.
- Tighten up _WIN64 conditioning.

svn path=/trunk/; revision=48143
2010-07-20 19:20:37 +00:00
Amine Khaldi
d0588d0064 [MINGW-W64]
- MSVC compatibility fixes.

svn path=/trunk/; revision=48142
2010-07-20 19:18:03 +00:00
Amine Khaldi
fc502885bc [FORMATTING]
- No functionality change.

svn path=/trunk/; revision=48141
2010-07-20 19:15:30 +00:00
Timo Kreuzer
154520a060 [ACCESS]
WRC doesn't like (x+x+x+2+x+x+x+x+x+x), use (x+x+x+x+x+x+x+x+x+2) instead. To figure out the reason is left as an exercise for the reader.

svn path=/trunk/; revision=48140
2010-07-20 19:10:02 +00:00
Timo Kreuzer
bd8190afa7 [EVENTVWR]
Add missing newline at end of file

svn path=/trunk/; revision=48139
2010-07-20 18:32:28 +00:00
Sylvain Petreolle
2bb936ad97 Remove BOM from UTF-8 rc files.
svn path=/trunk/; revision=48138
2010-07-20 16:37:22 +00:00
Amine Khaldi
88db16e943 [HEADERS]
- Make the header inclusion MSVC compatible.
- compstui now compiles with MSVC.

svn path=/trunk/; revision=48137
2010-07-20 15:51:44 +00:00
Timo Kreuzer
96353a5721 [FREELDR]
- Update isobtrt.asm to handle new PE bootloader, should fix bootcdregtest
- Disable debugging in isoboot.asm

svn path=/trunk/; revision=48136
2010-07-20 15:45:53 +00:00
Amine Khaldi
bc9f1e46f1 [HEADERS]
- Make the header inclusion MSVC compatible.
- localspl now compiles with MSVC.

svn path=/trunk/; revision=48135
2010-07-20 14:15:51 +00:00
Amine Khaldi
357f79fba6 [HEADERS]
- Make the header inclusion MSVC compatible.

svn path=/trunk/; revision=48134
2010-07-20 14:11:43 +00:00
Amine Khaldi
a92f03aea3 [MINGW-W64]
- Group MSVC related definitions.

svn path=/trunk/; revision=48133
2010-07-20 13:04:56 +00:00
Amine Khaldi
8d15da936a [ACPI]
- Define WIN32 when compiling with MSVC

svn path=/trunk/; revision=48132
2010-07-20 12:11:17 +00:00
Amine Khaldi
5be505d1b4 [MINGW-W64]
- Define WIN32_LEAN_AND_MEAN.
- Include stdlib.h for _winmajor.

svn path=/trunk/; revision=48131
2010-07-20 12:10:10 +00:00
Amine Khaldi
dfd1480154 [MINGW-W64]
- reactos.diff was pushed upstream, so it's not needed anymore.
- Add a missing section.
- Include sect_attribs.h into tlssup.c

svn path=/trunk/; revision=48130
2010-07-20 10:14:07 +00:00
Timo Kreuzer
280df5a49b [CMD]
Remove BOMs from rc files. Let me know if something's wrong with that.

svn path=/trunk/; revision=48129
2010-07-20 04:22:04 +00:00
Timo Kreuzer
ba97a937c2 [RBUILD]
For amd64 builds, invoke wrc directly, instead of using gcc to preprocess the files. The reason is that newer gcc versions (like 4.5.0) don't support multiline continuation  (backslash-newline) except for preprocessor directives, but that breaks wine resource strings. This might have to be done for i386 builds too, sooner or later.

svn path=/trunk/; revision=48128
2010-07-20 03:01:57 +00:00
Timo Kreuzer
0228d0009e [wine/commctrl.h]
Don't use #include_next, instead imclude psdk/commctrl.h

svn path=/trunk/; revision=48127
2010-07-20 02:53:55 +00:00
Timo Kreuzer
d2f3e93b11 [sdkddkver.h]
Add UL suffix to some constants.

svn path=/trunk/; revision=48126
2010-07-20 02:52:40 +00:00
Timo Kreuzer
a3d974ee28 [rpcndr.h]
Add a tag to NDR_SCONTEXT struct. MS headers don't have it, but gcc 4.5.x requires it, because without the tag, the struct would be from an unnamed namespace and can't be shared by different compilation units in C++. Yeah whatever...

svn path=/trunk/; revision=48125
2010-07-19 23:47:00 +00:00
Timo Kreuzer
2a5f6261a5 [FREELDR]
Convert freeldr and setupldr to PE format.
Previously freeldr was a raw binary file, which made handling by the bootsector very easy, but it disqualified it from proper debugging with gdb using symbols. This is possible with having unstripped PE files.
As we don't have any space to do proper PE loading from the bootsector (I already had to trim some strings to get enough space for the new jump code), we need to make sure, that the PE file doesn't contain a .bss section, which is achieved by a linker script. The next thing is to make sure, we don't have any symbols in the output file, because they would make freeldr too big to be loaded into memory and they are useless anyway. On the other hand we like to keep the symbols in the .nostrip.sys files if requested, as this is the primary purpose. This is in theory not a problem, as we could simply strip the file at the end, but binutils throw a monkey wrench in our plans: both strip and objcopy disrespect the file alignment and create unaligned sections, that don't naturally match their VAs. This is solved by hacking rbuild to do invoke ld 2 times, one time without and one time with the symbols (if requested).
Now the bootsectors also got some changes: instead of jumping to the loading address (0x8000) they get the address of the entry point from the image optional header. This is slightly simplified, by assuming the NtHeader begins at offset 0xE0. This finally allows source level debugging of freeldr with gdb.

svn path=/trunk/; revision=48124
2010-07-19 23:18:31 +00:00
Jérôme Gardou
de85efc5ed [WIN32K]
- rewrite UserDrawIconEx, taken from yarotows, with same small modifications.
Fixes a whole bunch of user32:cursoricon tests


svn path=/trunk/; revision=48123
2010-07-19 22:41:35 +00:00
Timo Kreuzer
76d0b0da01 [RTL]
- Update amd64 specific code to be MSVC compatible
- Remove Leading underscores from symbols

svn path=/trunk/; revision=48122
2010-07-19 21:18:33 +00:00
Eric Kohl
d4353528e6 [ADVAPI32]
LookupAccountSidA:
- Change variable prefixes according to the variable type.
- Initialize Unicode strings after the call to LookupAccountSidW because the string length is not set properly otherwise.

svn path=/trunk/; revision=48121
2010-07-19 20:27:36 +00:00
Timo Kreuzer
4ea3ee5cd7 [NDK]
Protect LDT_ENTRY from redefinition

svn path=/trunk/; revision=48120
2010-07-19 19:43:09 +00:00
Timo Kreuzer
24480b9b7d [KERNEL32]
Merge r34770, r36475, r36990, r37019, r43852, r43952, r43954, r43979, r43981, r46868 from amd64 branch:
- Multiple ULONG / SIZE_T fixes
- Use UlongToHandle / HandleToUlong to convert between DWORD ProcessId and ClientId.UniqueProcess
- implement amd64 version of _dump_context
- Make IsConsoleHandle 64bit safe
- Update kernel32.pspec with a lot of Win7 (commented out) and some amd64 specific exports, add some more comments and fix sorting
- Implement amd64 version of BaseThreadStartupThunk and BaseProcessStartThunk
- Stub amd64 version of SwitchToFiber
- Implement amd64 version of BasepInitializeContext

svn path=/trunk/; revision=48119
2010-07-19 18:52:18 +00:00
evb
0b09093a76 Last code in PciScanBus: call to PciGetfunctionLimits now implement (call PcipGetfunctionLimits if PciSkipThisFunction say no)
PcipGetfunctionLimits support PCI_HACK_CRITICAL_DEVICE and PCI Debug Device by use IPI code (PciExecuteCriticalSystemRoutine implement)
PciConfigurators table define for Device, PCI-to-PCI (PP) Bridge plus CardBus Bridge but all configurator stub now
Configurator chain: Init (Massage) -> [WRITE INIT] (PciWriteLimitsAndRestoreCurrent) -> Restore -> SaveLimit -> SaveCurrent
Support ExpectedWritebackFailure
Fix bug in PciApplyHacks (found by me testing sir_richard code)
Now pass 7000 SLOC ^_^;~ Good night!

svn path=/trunk/; revision=48118
2010-07-19 16:35:52 +00:00
Sir Richard
c4c9522794 [HALACPI]: Wherever I(?) copy pasted the original HalAdjustResourceList from, in the ACPI HAL, I have no idea, but the definition was totally wrong. Should fix the build.
svn path=/trunk/; revision=48117
2010-07-19 15:32:13 +00:00
Sir Richard
0e248c787d Joint patch
By sir_richard: [PCIX]: - Implement PciIsSlotPresentInParentMethod for ACPI query, and PcoDecodeEnable utility function.
                	- Implement PciConfigureIdeController based on WDHC Whitepaper "How Windows Switches a Controller to Native Mode". Check for PciEanbleNativeModeATA in registry, InitSafeBootMode, and call the ACPI driver to evaluate if NATA is present on the slot. Only configure the controller if both channels support native mode, as this is a Windows restriction.
                        - Implement PciApplyHacks for enumeration and resource update cases. In the first case, we handle legacy DEC Alpha Intel i82375 and i82378 PCI-to-(E)ISA bridges with invalid class codes. In the second, we configure IDE controllers for Native mode, except the OPTi Viper-M, which is known to cause issues. We also support cards with legacy VGA decodes by telling the arbiter to enable full access to the rangesm and finally we completely disable the decodes on Compaq PCI Hotplug Controllers (Revision 17) on PAE systems, as they have bugs handling 64-bit addresses. Finally, on resource updates, we apply a vendor-specific errata to the IBM 20H2999 PCI Docking Bridge (Hotplug) used on Thinkpad 600 Series laptops, and we attempt to avoid issues that can happen on certain devices that are plugged into an ICH1/2/3/4 Intel Hub when it has been configured to do subtractive decode. Full information on these workarounds can be seen in the comments. Finally, we also enable CardBUS devices for ACPI-compliant mode, by crossing out the LegacyBaseAddress in the CardBUS Type 2 PCI Configuration Header.
			- Miscelleaneous code cleanups.
By eVb: More PciScanBus support, for debug PCI caps that driver use are dump, and detect nonBIOS configure device (spec is said that CacheLineSize != 0, LatencyTimer != 0 (on PCI-X, != 64)), if found NeedsHotPlugConfiguration to be set
By eVb: Support PCI_HACK_VIDEO_LEGACY_DECODE (call ario_ApplyBrokenVideoHack, but no arb support to do work)

svn path=/trunk/; revision=48116
2010-07-19 15:15:39 +00:00
Sir Richard
422f215958 [NDK]: Add a missing HAL function.
[PCI]: Update hack flags.

svn path=/trunk/; revision=48115
2010-07-19 15:14:34 +00:00
Amine Khaldi
fc8c4be858 [MINGW]
- __attribute__ ((__unused__)) -> __UNUSED_PARAM, which is MSVC compatible.

svn path=/trunk/; revision=48114
2010-07-19 09:58:51 +00:00
Amine Khaldi
693a016f71 [PSDK]
- Fix IOCTL_STORAGE_* redefinitions.

svn path=/trunk/; revision=48112
2010-07-19 01:06:32 +00:00
Amine Khaldi
72268d0e17 [CRT]
- Fix the double use of _CRTIMP.

svn path=/trunk/; revision=48111
2010-07-19 00:25:54 +00:00
Amine Khaldi
853b658b58 - Fix _InterlockedExchangeAdd16, _InterlockedCompareExchangePointer and _InterlockedExchangePointer intrinsics.
svn path=/trunk/; revision=48110
2010-07-18 22:43:04 +00:00
Amine Khaldi
5c0e7d3b75 Merge r45430 from amd64-bringup : Add #pragma intrinsic for msvc intrinsics.
svn path=/trunk/; revision=48109
2010-07-18 21:55:54 +00:00
Eric Kohl
5ef81f0fae [ADVAPI32/LSASRV]
- LookupAccountNameW: Call LsaLookupNames instead of returning a dummy name.
- Implement LsaLookupNames. Calls LsarLookupNames.
- LsarLookupNames: return dummy names.

svn path=/trunk/; revision=48108
2010-07-18 20:34:34 +00:00
evb
8091e98e96 Can't sleep so write more source codes! add scan bus functions to get power caps (PciGetEnhancedCapabilities) and AGP caps, use PciReadDeviceCapability util function, now can get wake levels, PCI power state plus target AGP ID. Now can find PCI Device that can't sleep neither! Ha-ha!
Support PCI_HACK_NO_PM_CAPS, PCI_HACK_PRESERVE_COMMAND, PCI_HACK_DONT_DISABLE_DECOES
Add scan bus function to set power for PCI, for now to power up (PciSetPowerManagedDevicePowerState), with support for device that is critical/broken (PciCanDisableDecodes)
Check spec-correct with PciStallForPowerChange after define PciPowerDelayTable for D0<->D3 crossmatrix spec timings (add PciReadDeviceConfig for support)
If bad spec timing use PCI verifier support (PciVerifierRetrieveFailureData) + STATUS_DEVICE_PROTOCOL_ERROR
Add PciVerifierFailureTable with all failure type
Almost the time for resource discovery of BARs!


svn path=/trunk/; revision=48107
2010-07-18 18:58:33 +00:00
Jérôme Gardou
a6017cd9b2 [W32KNAPI] - More tests to NtUserGetIconInfo
svn path=/trunk/; revision=48106
2010-07-18 16:57:32 +00:00
Jérôme Gardou
2946af0b8e Fix my grotesque mistake of r48104
svn path=/trunk/; revision=48105
2010-07-18 16:45:05 +00:00
Jérôme Gardou
0f1aba925e [W32KNAPI] - Add some more NtUserGetIconInfo tests
svn path=/trunk/; revision=48104
2010-07-18 16:40:15 +00:00
Jérôme Gardou
ec5e0ea56a [W32KNAPI] - Add some more NtUserGetIconInfo tests
svn path=/trunk/; revision=48103
2010-07-18 16:34:14 +00:00
Amine Khaldi
715a75ef6b [PSDK]
- Fix a couple of FIXMEs : UNALIGNED and RESTRICTED_POINTER definitions

svn path=/trunk/; revision=48102
2010-07-17 21:19:38 +00:00
Eric Kohl
faf61e4427 [LSASRV]
LsarLookupSids: Return ReferencedDomains information.

svn path=/trunk/; revision=48101
2010-07-17 18:15:34 +00:00
evb
54dcdffd9e More PciScanBus codes now to check saved PCI BIOS config header saved in registry (PciGetBiosConfig, PciSaveBiosConfig) and support load save compare (PcipIsSameDevice) if change in interrupt line
Also for interrupt line use HAL to get parent bus IRQ# if device connected (PciGetAdjustedInterruptLine)
For PCI debug HW PciIsDeviceOnDebugPath to detect, but have not real machine with this kind of device to test
Support PCI_HACK_NO_SUBSYSTEM and PCI_HACK_NO_SUBSYSTEM/REVISION_AFTER_D3 for when compareing
New config function required PciWriteDeviceConfig to update IRQ line from BIOS registry data
Save initial, current Command enables to PDO extension, interrupt data too

svn path=/trunk/; revision=48100
2010-07-17 16:53:18 +00:00
evb
693551c36a Implement PciPdoCreate and add all PDO IRP stub functions, set dispatch table for major/minor command, add PciIrpInvalidDeviceRequest
Fix bug in PciFindPdoByFunction should check device slot info too
Add more enumeration codes in PciScanBus to create PDO
PCI_HACK_FAKE_CLASS_CODE support
Build PDO extension, set ready for PnP manger, now 41 QDR returned
Add PCI/CardBus Bridge to list
Detect bridge/IDE controller with no power down support, hack for Intel 82375 PCI to EISA bridge for Alpha thanks to sir_richard
QUERY_ID is sent to PDOs now!

svn path=/trunk/; revision=48099
2010-07-17 15:59:09 +00:00
evb
7ebde38343 More implement of PciScanBus, now read hack flags from table (PciGetHAckFlags), and check for critical device (PciIsCriticalDeviceClass) and VGA device on PCI bridge
Do check for skipping some function (double decker ghost, Intel Alder SMP Pentium Pro machine, hacl flag, more), PciSkipThisfunction
Do check for PDO already exist for function (PciFindPdoByFunction)
Finish impement PciFindParentPciFdoExtension

svn path=/trunk/; revision=48098
2010-07-17 15:09:19 +00:00
Amine Khaldi
11006f580c [PSDK]
- Add missing netevent.h definitions.

svn path=/trunk/; revision=48097
2010-07-17 13:13:18 +00:00
Amine Khaldi
0fc10b9203 [DDK]
- Move netevent.h to PSDK.

svn path=/trunk/; revision=48096
2010-07-17 10:09:09 +00:00
Amine Khaldi
76fab2e228 [DDK]
- Move ntddndis.h to PSDK.

svn path=/trunk/; revision=48095
2010-07-17 09:42:56 +00:00
Amine Khaldi
8cf2899a61 [PSDK]
- Fix a couple of typos

svn path=/trunk/; revision=48094
2010-07-17 09:01:00 +00:00
Eric Kohl
dfa8e56472 [LSASRV]
Use a single table for mapping privilege names to values and values to names.

svn path=/trunk/; revision=48093
2010-07-17 07:37:47 +00:00
Timo Kreuzer
ac595f39c9 [KERNEL32]
DWORD -> SIZE_T in ReadProcessMemory

svn path=/trunk/; revision=48092
2010-07-17 05:18:31 +00:00
evb
f43651e238 Add config interface start (PciReadWriteConfigSpace, PciReadSlotConfig)
Add PDO_EXTENSION structure and PCI_FUNCTION_RESOURCES, now delete #if0 in old code since PDO_EXTENSION is now exist defintion
Add ID Class/Subclass to description functions (PciGetDeviceDescriptionMessage, PciGetDescriptionMessage), use pciclass.mc from sir_richard
New debug: PciDebugDumpCommonConfig
Implement IRP_MN_QUERY_DEVICE_RELATIONS with PciFdoIrpQueryDeviceRelations and PciQueryDeviceRelations
Begin PciScanBus, now just dump all found device with no more work (0 QDR return)

svn path=/trunk/; revision=48091
2010-07-17 01:31:26 +00:00
Timo Kreuzer
4234345b03 Fix CryptReleaseContext parameter, wine uses an outdated version (< NTDDI_WINXP)
svn path=/trunk/; revision=48090
2010-07-16 21:30:29 +00:00
Timo Kreuzer
623cc2e0dd [WS2_32]
DWORD -> DWORD_PTR

svn path=/trunk/; revision=48089
2010-07-16 20:24:32 +00:00
Timo Kreuzer
9908019e62 [VIDEOPRT]
Merge r40926 from amd64 branch:
return ERROR_INVALID_FUNCTION on amd64, not ERROR_INVALID_ACCESS from VideoPortEn/DisableInterrupt. Fixes compilation of videoprt for amd64.

svn path=/trunk/; revision=48088
2010-07-16 19:20:49 +00:00
Timo Kreuzer
677bd3c418 [NTOSKRNL]
- #if out RtlpCaptureStackLimits on amd64 as well

svn path=/trunk/; revision=48087
2010-07-16 17:53:00 +00:00
Timo Kreuzer
d2c2d5b635 [NDK]
Merge r44053 from amd64 branch:
- Add KEXCEPTION_FRAME

svn path=/trunk/; revision=48086
2010-07-16 17:20:46 +00:00
Timo Kreuzer
3c70caa7e3 [NTOSKRNL]
Add MM_HIGHEST_VAD_ADDRESS for amd64

svn path=/trunk/; revision=48085
2010-07-16 17:14:53 +00:00
Timo Kreuzer
ef44812048 [NTOSKRNL]
#if out another broken C_ASSERT on amd64

svn path=/trunk/; revision=48084
2010-07-16 16:30:05 +00:00
Timo Kreuzer
36fa896cff [NTOSKRNL]
Comment out a broken C_ASSERT on amd64 to make it compile.

svn path=/trunk/; revision=48083
2010-07-16 15:11:44 +00:00
Timo Kreuzer
2faf924bad [CRT]
Move #include <precomp.h> to the top, as precompiled headers must be the first thing that is included or it won't take advantage of being precompiled

svn path=/trunk/; revision=48082
2010-07-16 15:08:03 +00:00
Timo Kreuzer
f01fb95ae9 [NTOSKRNL]
ULONG -> SIZE_T

svn path=/trunk/; revision=48081
2010-07-16 14:56:36 +00:00
Gabriel Ilardi
386c15f491 Fix build, sorry. Thanks Timo.
svn path=/trunk/; revision=48080
2010-07-16 13:37:29 +00:00
Timo Kreuzer
e6d5126886 Merge r44143 from amd64 branch
Initialize MmDebugPte from MiDebugMapping variable instead of using MiAddressToPte for a constant initializer. This way the page can be set dynamically. Use MmDebugPte to determine if ready for mapping physical pages.

svn path=/trunk/; revision=48079
2010-07-16 13:23:43 +00:00
Gabriel Ilardi
f9dc8f0766 [CRT]
Add a debug print to help bugs like 5486.

svn path=/trunk/; revision=48078
2010-07-16 13:00:02 +00:00
Daniel Reimer
d17757a733 [PATCH] user32: DrawText: CJK and Thai line-wrapping
[PATCH] appwiz: check if path is valid
Both by Katayama Hirofumi

svn path=/trunk/; revision=48077
2010-07-16 12:52:37 +00:00
Timo Kreuzer
3421c58c28 [NTOSKRNL]
ULONG -> ULONG_PTR

svn path=/trunk/; revision=48076
2010-07-16 12:27:40 +00:00
evb
2261af5265 IRP_MN_START_DEVICE implement for ROOT FDO (PciFdoStartDevice)
PciInitializeArbiterRanges implement to scan arbiter   not yet construct since Arb library missing
Add PCI state machine (PciBeginStateTransition, PciCancelStateTransition, PciCommitStateTransition) andtransition array (PnpStateTransitionArray) to check if valid
Now IRP_MN_QUERY_DEVICE_RELATIONS sent to ROOT FDO means time to enumerate bus!

svn path=/trunk/; revision=48075
2010-07-16 01:14:52 +00:00
evb
add164dcfa Fix for code to handle IRP dispatching when unrecognized IRP (Thanks you sir_richard)
Add FDO IRP_MN_QUERY_INTERFACE support (it calls PciQueryInterface)
Add all PCI interface descriptor: PciLocationInterface (GUID_PNP_LOCATION_INTERFACE), PciPmeInterface (GUID_PCI_PME_INTERFACE), PciCardbusPrivateInterface (GUID_PCI_CARDBUS_INTERFACE_PRIVATE), PciLegacyDeviceDetectionInterface (GUID_LEGACY_DEVICE_DETECTION_STANDARD), AgpTargetInterface (GUID_AGP_TARGET_BUS_INTERFACE_STANDARD), PciRoutingInterface (GUID_INT_ROUTE_INTERFACE_STANDARD), BusHandlerInterface (GUID_BUS_INTERFACE_STANDARD) and stub initializer and constructor.
Add missing devhere.c interface file
Add all PCI arbiter descritptor: ArbiterInterfaceBusNumber, ArbiterInterfaceMemory, ArbiterInterfaceIo. Write constructor stub but not handled ArbitersInitialized == TRUE
Also add last-resort PCI interface: TranslatorInterfaceInterrupt (GUID_TRANSLATOR_INTERFACE_STANDARD) and part implement tranirq_Constructor
Add PciQueryInterface to find correct FDO/PDO/ROOT interface for a request and call interface constructor
Fix interface signatures, fix interface constructor type and PCI_INTERFACE, add interface flags (Thanks sir_richard)
Fix Aribtriter code (Thanks sir_richard)
Now another 1200 codes added, soon time for enumeration code!

svn path=/trunk/; revision=48074
2010-07-16 00:39:54 +00:00
Timo Kreuzer
d80d59dbff Merge 36852, 37322, 37333, 37334, 43428, 43451, 44259, 46404 from amd64 branch.
- Multiple ULONG/ULONG_PTR/SIZE_T issues
- Use SLIST_ENTRY instead of SINGLE_LIST_ENTRY with InterlockedPushEntrySList
- Use %p to print pointer sized values


svn path=/trunk/; revision=48073
2010-07-16 00:34:26 +00:00
Timo Kreuzer
8e13b57dcf Add MI_MIN_SECONDARY_COLORS, MI_SECONDARY_COLORS and MI_MAX_SECONDARY_COLORS for amd64
svn path=/trunk/; revision=48072
2010-07-16 00:03:03 +00:00
Timo Kreuzer
72053553f4 [NTOSKRNL]
Some ULONG vs SIZE_T fixes

svn path=/trunk/; revision=48071
2010-07-15 23:56:53 +00:00
Timo Kreuzer
820d3edcb0 Merge 44257 from amd64 branch:
PFN_TYPE -> PFN_NUMBER

svn path=/trunk/; revision=48070
2010-07-15 22:50:12 +00:00
Timo Kreuzer
70103e0a78 Remove svn:mergeinfo property
svn path=/trunk/; revision=48069
2010-07-15 22:43:13 +00:00
Amine Khaldi
b22a3883dc [PSDK]
- Fix WS2TCPIP_INLINE : extern inline -> static inline

svn path=/trunk/; revision=48067
2010-07-15 19:34:21 +00:00
Jérôme Gardou
9889c134f2 SVN wins again... What's that?
Revert everything that's not related to 48064 of 48065.

svn path=/trunk/; revision=48066
2010-07-15 19:29:45 +00:00
Jérôme Gardou
af95756f02 Merge 48064 from yarotows
This had nothing to do in yarotows in the first place

svn path=/trunk/; revision=48065
2010-07-15 19:19:48 +00:00
Timo Kreuzer
060168268f [NTOSKRNL]
Fix some amd64 KGDT constant names

svn path=/trunk/; revision=48063
2010-07-15 11:24:17 +00:00
Timo Kreuzer
11d95dfa7e [NTOSKNL]
#undef IoAllocateAdapterChannel before implementing it

svn path=/trunk/; revision=48062
2010-07-15 11:20:22 +00:00
Gabriel Ilardi
87bf4616fb [shellapi.h] Fix build copy pasta spotted by encoded
svn path=/trunk/; revision=48061
2010-07-15 07:16:08 +00:00
Timo Kreuzer
0d37dab9f3 [NTOSKRNL]
Fix ExInitializeRundownProtectionCacheAware parameter (ULONG -> SIZE_T)

svn path=/trunk/; revision=48060
2010-07-15 01:34:50 +00:00
Timo Kreuzer
f08b9d1821 [NTOSKRNL]
- Define PD_COUNT, PDE_COUNT, PTE_COUNT for amd64, we should probably use PTE_PER_PAGE... instead
- Fix incompatible declaration of MmResidentAvailablePages
- Prevent duplicate definitions

svn path=/trunk/; revision=48059
2010-07-15 01:10:18 +00:00
Timo Kreuzer
0f9bd40ee3 [NTOSKRNL]
Remove the old amd64 compilation hack

svn path=/trunk/; revision=48058
2010-07-15 00:42:26 +00:00
Timo Kreuzer
8518877b95 [NTOSKRNL]
Apply a workaround for WDK headers

svn path=/trunk/; revision=48057
2010-07-15 00:24:38 +00:00
Timo Kreuzer
20b79b0029 [NTOSKRNL]
KeQuerySystemTime and KeQueryInterruptTime are not implemenetd on amd64

svn path=/trunk/; revision=48056
2010-07-15 00:07:31 +00:00
Timo Kreuzer
50e511c01d [shellapi.h]
fix inclusion of pshpack / poppack (global and not for _WIN64)

svn path=/trunk/; revision=48055
2010-07-14 23:52:48 +00:00
Timo Kreuzer
6ae7a76cda [ntdll_winetest]
Comment out some tests for WIN64 builds (wine headers are broken)

svn path=/trunk/; revision=48054
2010-07-14 23:13:31 +00:00
Timo Kreuzer
58358394d6 Fix build
svn path=/trunk/; revision=48053
2010-07-14 22:32:06 +00:00
Sylvain Petreolle
2500a82fc2 gdi32:generated should now build on x64.
svn path=/trunk/; revision=48052
2010-07-14 22:08:19 +00:00
Sylvain Petreolle
34316a4b6a A little closer to x64 compat in GDI headers.
Patch by Samuel Serapion.


svn path=/trunk/; revision=48051
2010-07-14 22:02:51 +00:00
Timo Kreuzer
b90cf1a22e [GDI32_WINETEST]
Don't compile generated.c on amd64

svn path=/trunk/; revision=48050
2010-07-14 21:36:24 +00:00
Cameron Gutman
79e8db1b56 [PING]
- Fix a bug in the lost packet counter code which could result in a negative received value

svn path=/trunk/; revision=48046
2010-07-14 19:32:03 +00:00
Daniel Reimer
7fe1842203 Bug 5413: [PATCH] regedit: app key on treeview/listview
Bug 5473: [PATCH] regedit: selection on hexedit
Both from Katayama Hirofumi

svn path=/trunk/; revision=48045
2010-07-14 18:15:43 +00:00
Daniel Reimer
585c3a511e Fix setupapi setupcab winetest. (Samuel Serapion)
svn path=/trunk/; revision=48044
2010-07-14 17:18:49 +00:00
Daniel Reimer
a67f202e5e Fix libtiff's external functions.
svn path=/trunk/; revision=48043
2010-07-14 17:12:22 +00:00
Jérôme Gardou
1954fd59da [WIN32K]
- Properly initialize hVisRgn in CLIPPING_UpdateGCRegion
This fixes a whole bunch of "IntGdiCombineRgn requires hSrc2 != NULL for combine mode 1!", and probably some bugs.
Dedicated to encod3d.

svn path=/trunk/; revision=48042
2010-07-14 16:12:32 +00:00
Jérôme Gardou
746e0c9afd [USER32]
- WINE creates an alpha bitmap on icon creation, we do it when drawing it, so we need to create a bitmap which holds alpha information.
  - Add error handling to CreateIconIndirect.

svn path=/trunk/; revision=48041
2010-07-14 15:42:44 +00:00
Jérôme Gardou
d61b5efe6c [WIN32K, USER32]
- Get rid of ONEPARAM_ROUTINE_CREATECURICONHANDLE

svn path=/trunk/; revision=48040
2010-07-14 15:01:02 +00:00
Jérôme Gardou
8ad729230c [W32KNAPI]
- Test ONE_PARAM_ROUTINE_CREATEEMPTYCUROBJECT
  - Test NtUserGetIconInfo

svn path=/trunk/; revision=48039
2010-07-14 14:56:53 +00:00
Daniel Reimer
f4769202d7 Reapply some Win32 specific magic to properly build a Windows DLL of libjpeg. (Samuel Serapion)
svn path=/trunk/; revision=48038
2010-07-14 14:53:35 +00:00
Daniel Reimer
89324d2493 Bye, old Downloader.
svn path=/trunk/; revision=48037
2010-07-14 11:00:31 +00:00
Daniel Reimer
06f1bc2133 Bug 5501: [PATCH] Adding Wing32 support by Carlo Bramini
svn path=/trunk/; revision=48036
2010-07-14 10:59:32 +00:00
Jérôme Gardou
98b46cd0c4 Bye bye NtUserCreateCursorHandle.
Thanks GedMurphy for explaining me how to suppress that.
Please clean win32k after this commit.

svn path=/trunk/; revision=48035
2010-07-14 10:23:13 +00:00
Jérôme Gardou
4cc98d4c14 [USER32]
- There is no exported "CopyCursor", it's a macro.
  - There is no "NtUserCreateCursorIconHandle" function in win32k. Use correct functions to create a cursorIcon handle.
  - Bring in WINE's CreateIconIndirect
[WIN32K]
  - Dereference CursorIcon Object in NtUserCallOneParam
  - Shared Icons need their bitmaps to be unowned

svn path=/trunk/; revision=48034
2010-07-14 09:54:44 +00:00
Jérôme Gardou
e393257fc3 [USER32]
- Partly merge 48026

svn path=/trunk/; revision=48031
2010-07-13 21:38:34 +00:00
Cameron Gutman
17f5ddd1e0 [WS2_32]
- Update the catalog ID when we locate the matching provider
- mswsock from aicom-network-branch can successfully create sockets now

svn path=/trunk/; revision=48023
2010-07-13 00:54:52 +00:00
Cameron Gutman
a37a8bfe92 [AFD]
- Implement IOCTL_AFD_GET_TDI_HANDLES

svn path=/trunk/; revision=48020
2010-07-12 22:56:37 +00:00
Daniel Reimer
c88bff245c Thanks to Samuel Serapion and his trout, explaining me my fault.
svn path=/trunk/; revision=48019
2010-07-12 19:55:52 +00:00
Cameron Gutman
6ce27e86b9 [DNSAPI]
- Merge r45450 from aicom-network-branch

svn path=/trunk/; revision=48018
2010-07-12 19:36:42 +00:00
Daniel Reimer
795f1b72e1 Tidy up tree from duplicate files.
svn path=/trunk/; revision=48017
2010-07-12 19:25:20 +00:00
Cameron Gutman
67f5ef564f [PSDK]
- Add the missing WSANO_ADDRESS definition

svn path=/trunk/; revision=48016
2010-07-12 19:21:11 +00:00
Daniel Reimer
a71a4c7943 Forgot to remove the old libpng.
svn path=/trunk/; revision=48015
2010-07-12 19:07:39 +00:00
Daniel Reimer
812e29c75a Update libjpeg from 6b to 8b.
Add a new libpng 1.4.3 to main tree, linked dynamically, as libjpeg is, too.
Add libtiff 3.9.4, linked dynamically, too.
Enable both libs in wine/config.h which results in working png and tiff support in windowscodecs.dll

svn path=/trunk/; revision=48014
2010-07-12 19:05:15 +00:00
Daniel Reimer
7e93e6537f remove the old and static linked libpng. A new one will follow into the main tree, linked as dll for windowscodecs.dll.
svn path=/trunk/; revision=48013
2010-07-12 19:02:47 +00:00
Cameron Gutman
2d0076856f [WINSOCK]
- Merge r48011 from aicom-network-branch

svn path=/trunk/; revision=48012
2010-07-12 18:58:17 +00:00
Cameron Gutman
5ed63500c2 [MSAFD, PSDK]
- Merge part of r45435

svn path=/trunk/; revision=48010
2010-07-12 18:41:41 +00:00
Cameron Gutman
525e7111c4 [WINSOCK]
- Add winsock headers required for the new mswsock code

svn path=/trunk/; revision=48009
2010-07-12 18:31:45 +00:00
Jérôme Gardou
0b5d0c20e8 [USER32]
- Rewrite support of cursors, icons and bitmaps in user32.dll, based from WINE implementation.
One file to rule them all.
Now user32::cursoricon winetests don't crash anymore.

svn path=/trunk/; revision=48008
2010-07-12 17:49:59 +00:00
Jérôme Gardou
74cae57136 [WIN32K]
- Get rid of rosdc::hVisRgn, as in yarotows (r46372)

svn path=/trunk/; revision=48007
2010-07-12 16:52:10 +00:00
Daniel Reimer
13ef18576c Forgot one kernel32 include.
svn path=/trunk/; revision=48006
2010-07-12 15:31:49 +00:00
Amine Khaldi
cd21d25fc7 [LIB/RTL]
- Get rid of some unneeded assignment, cast and a variable.

svn path=/trunk/; revision=48005
2010-07-12 14:50:31 +00:00
Daniel Reimer
1aa82b4f2c Reapply the idea of r44368. Remove the "kernel32" library reference in all .rbuild files of user-mode modules, because this one is already added by "mingw_common".
Add SuperFinder XT to rapps.

svn path=/trunk/; revision=48004
2010-07-12 10:35:11 +00:00
Pierre Schweitzer
17458060a5 [NTOSKRNL]
Merging some stuff from pierre-fsd/arty-newcc branches:
- Implemented FsRtlDissectDbcs(), FsRtlIsDbcsInExpression(), FsRtlIsFatDbcsLegal(), FsRtlIsHpfsDbcsLegal()
- Implemented FsRtlIsNameInExpressionPrivate()
- Rewritten FsRtlIsNameInExpression()
- Updated comments
About FsRtlIsNameInExpressionPrivate(), it comes with a fix there isn't in branch, which avoids reading string more than its own length, and this helps getting rid of a workaround later in code.

svn path=/trunk/; revision=48002
2010-07-11 21:31:14 +00:00
Sylvain Petreolle
604a7a51ed Properly skip known crasher in gdi32:metafile test.
Commit 48k dedicated to dreimer

svn path=/trunk/; revision=48000
2010-07-11 19:11:51 +00:00
Sylvain Petreolle
cbc71e8180 Implement _osplatform
Import _makepath_s and _wmakepath_s from Wine.
Passes msvcrt data and dir tests.

svn path=/trunk/; revision=47999
2010-07-11 16:25:30 +00:00
Eric Kohl
b7bf7335b9 [ADVAPI32]
Move event tracing functions to the proper file.

svn path=/trunk/; revision=47998
2010-07-11 12:05:35 +00:00
Eric Kohl
98e2b9fe96 [ADVAPI32]
Remove unused code.

svn path=/trunk/; revision=47997
2010-07-11 09:45:54 +00:00
Eric Kohl
abed1067fc [ADVAPI32/LSASRV]
- Export LsaLookupPrivilegeName.
- Move mockup code from advapi32 to lsasrv (LsaLookupSids --> LsarLookupSids).
- Make LsaLookupSids call the server function LsarLookupSids.

svn path=/trunk/; revision=47996
2010-07-11 09:33:44 +00:00
Aleksey Bragin
2d3333aa11 [WINLOGON]
- Create window station with all access rights.

svn path=/trunk/; revision=47992
2010-07-11 08:07:52 +00:00
Aleksey Bragin
bc5435e23f - Fix a typo.
svn path=/trunk/; revision=47991
2010-07-10 21:39:55 +00:00
Sylvain Petreolle
e2a0a87a41 Revert rpcrt4 to 99% previous state :
-keep out unix functions
-keep checks that prevent crashes in rpc cstub and rpc winetests

Patch By Samuel Serapion.


svn path=/trunk/; revision=47990
2010-07-10 19:31:06 +00:00
Sylvain Petreolle
b3d626d1bd Fixup some base address after mshtml growup.
svn path=/trunk/; revision=47989
2010-07-10 18:47:45 +00:00
Sylvain Petreolle
9b2895628c Also update comdlg32 address.
svn path=/trunk/; revision=47988
2010-07-10 14:34:20 +00:00
Sylvain Petreolle
5bd00143b5 Update comctl32 base address.
Avoids inetcomm related comctl32 relocations.

svn path=/trunk/; revision=47986
2010-07-10 13:11:28 +00:00
Amine Khaldi
baea2e4b5c [NTOS]
PnpBusTypeGuidGet : Really return status.
Dedicated to Richard ;)

svn path=/trunk/; revision=47985
2010-07-10 10:34:45 +00:00
Sylvain Petreolle
01e297699a Forgot to svn add this in previous commit, my bad.
svn path=/trunk/; revision=47983
2010-07-09 21:05:01 +00:00
Sylvain Petreolle
850598a5f5 Import DnsNameCompare, DnsValidateName, DnsRecord* functions from Wine.
Fixes dnsapi:name tests.
Patch by Samuel Serapion.


svn path=/trunk/; revision=47982
2010-07-09 20:56:12 +00:00
Pierre Schweitzer
b50d23da11 [FASTFAT]
Check PathName length before accessing it. This fixes ntdll_winetest file test BSOD. But the test crashes a bit farther.

svn path=/trunk/; revision=47981
2010-07-09 19:39:55 +00:00
Amine Khaldi
ac309351d3 [DDK]
- Remove ntddscsi.h
[PSDK]
- Import ntddscsi.h from mingw-w64.

svn path=/trunk/; revision=47979
2010-07-09 14:39:28 +00:00
Sylvain Petreolle
697fc48c13 Sync __crtGetStringTypeW from Wine.
Fixes msvcrt:locale crash.


svn path=/trunk/; revision=47978
2010-07-09 14:33:03 +00:00
Aleksey Bragin
52ee3d51b4 [FORMATTING]
- Fix wrong indentation.

svn path=/trunk/; revision=47977
2010-07-09 13:04:33 +00:00
Amine Khaldi
3d25efc5cf Ukrainian translation patch for mstsc, notepad, paint, regedit, cmd, aclui, newdev and syssetup. By Igor Paliychuk (Igor-hkr[at]mail.ru)
svn path=/trunk/; revision=47974
2010-07-08 22:07:23 +00:00
Gabriel Ilardi
2c261ebb98 [NTOSKRNL]
- Warn only once about FsRtlPrivateLock and FsRtlFastUnlockSingle being stubplemented.

svn path=/trunk/; revision=47972
2010-07-08 19:28:25 +00:00
Daniel Reimer
87ae6722bb Forgot to remove some now useless header
svn path=/trunk/; revision=47971
2010-07-08 18:44:59 +00:00
Daniel Reimer
ba086d41dd Sync rpcrt4 to Wine 1.2rc6 (Samuel Serapion)
http transport support commented out.
Remove unix functions that are no longer needed.
Comment out check in cpsf.c that caused 2nd stage dll registrations to fail.
All rpcrt4 tests no longer crash.

svn path=/trunk/; revision=47970
2010-07-08 18:39:18 +00:00
Gabriel Ilardi
9919e408d5 [MSIMTF]
- Silence debug spam again, lost after syncing.

svn path=/trunk/; revision=47969
2010-07-08 15:34:30 +00:00
Daniel Reimer
0c6baa560c Sync format_msg from kernel32 (Samuel Serapion)
Winetest now passes with 0 errors.

svn path=/trunk/; revision=47968
2010-07-08 15:20:46 +00:00
Amine Khaldi
aae7364207 [PSDK]
- Update DPFLTR_TYPE enum.
[NTOSKRNL]
- Update kdbg/kdb_cli.c accordingly.

svn path=/trunk/; revision=47967
2010-07-07 22:29:21 +00:00
Pierre Schweitzer
1781e13d31 [NTOSKRNL]
Implement volume mount notification in RawFS

svn path=/trunk/; revision=47965
2010-07-07 20:27:04 +00:00
Sylvain Petreolle
358331354d [CRT]
-Export memmove_s and memcpy_s
-Implement rnd_s


svn path=/trunk/; revision=47964
2010-07-07 20:05:47 +00:00
Daniel Reimer
5fd439a72e Ukrainian translation Update for taskmgr (Igor Paliychuk)
svn path=/trunk/; revision=47963
2010-07-07 17:45:49 +00:00
Daniel Reimer
d2c167121b This was not meant to be committed at all. the recent resources were much better and should stay
svn path=/trunk/; revision=47962
2010-07-07 14:10:19 +00:00
Daniel Reimer
6e4a54d5b5 Sync devenum, atl, comctl32, comdlg32, cryptdlg, cryptui, hhctrl, itss, jscript, mapi32, msacm32, mshtml, msi, msimtf, oleacc, pstorec, shdoclc, shdocvw, shlwapi, snmpapi, urlmon, usp10, uxtheme, windowscodecs, wldap32, wtsapi32, wuapi, xinput1_3
svn path=/trunk/; revision=47961
2010-07-06 23:29:26 +00:00
Sylvain Petreolle
baeea629ab sysreg doesn't like rain of SEMI-STUB debug
svn path=/trunk/; revision=47960
2010-07-06 20:01:55 +00:00
Pierre Schweitzer
0a78b4958c Fix a FIXME in fastfat driver which also fixes a BSOD in kernel32 path winetest
svn path=/trunk/; revision=47959
2010-07-06 18:39:09 +00:00
Michael Martin
df7159d459 - Implement DeviceHandleToUsbDevice and remove IsHandleValid.
- Add call to DeviceHandleToUsbDevice for all Direct Call functions that pass DeviceHandle.
- Stop the processing of Asynchronous List after the Control Request has been processed by controller.
- Misc changes.

svn path=/trunk/; revision=47958
2010-07-06 12:02:33 +00:00
Daniel Reimer
f1023cae8f Update package database to contain all winetests. This makes it possible to even use them in testman.
svn path=/trunk/; revision=47957
2010-07-06 10:31:24 +00:00
Daniel Reimer
1a0a71b131 Add amstream, atl and avifil32 winetests.
Sync opengl32, powrprof and fix quartz's testlist

svn path=/trunk/; revision=47956
2010-07-06 09:44:43 +00:00
Daniel Reimer
1538f60ca3 Reenable a disabled feature of actxprxy which builds now with the new shell32 headers
svn path=/trunk/; revision=47955
2010-07-06 09:40:55 +00:00
Daniel Reimer
ef1db99fd9 Sync shell32 and mshtml winetests (this time with modified testlist.c). This will unbreak build again :-P
svn path=/trunk/; revision=47954
2010-07-05 23:00:52 +00:00
Daniel Reimer
d848c9746e Sync most idl files with Wine head. (Samuel Serapion)
Modify shell32 and uuid to work with the new idls.
This will break build till next commit.

svn path=/trunk/; revision=47953
2010-07-05 23:00:19 +00:00
Daniel Reimer
e96b3a5001 Next try, this time not converted to utf-8 and it seems to work.
svn path=/trunk/; revision=47952
2010-07-05 21:22:50 +00:00
Daniel Reimer
a16e12a7f5 Revert the cmd Translation on demand of the author.
svn path=/trunk/; revision=47951
2010-07-05 21:10:08 +00:00
Cameron Gutman
5b40543137 [QMGR]
- Reapply r47268 to fix DHCP

svn path=/trunk/; revision=47950
2010-07-05 16:19:14 +00:00
Sylvain Petreolle
23caea8334 unix has no io.h.
move its include to a _WIN32 block.

svn path=/trunk/; revision=47948
2010-07-05 12:43:09 +00:00
Daniel Reimer
007f159c23 /me hides deep in the dark of loong warning messages
svn path=/trunk/; revision=47946
2010-07-05 11:39:50 +00:00
Daniel Reimer
63ab1f1ca4 update wine's unicode app to 1.2rc6. (Samuel Serapion)
update kernel32 nls files to be able to build it with the new unicode tool.
convert the cmd rc files to utf-8 to fix building.
Apply Igor Paliychuk's Ukrainian translation Patch.

svn path=/trunk/; revision=47945
2010-07-05 11:36:22 +00:00
Daniel Reimer
b09b99163c Silence zlibs warnings (Samuel Serapion)
Update eeadme.wine

svn path=/trunk/; revision=47944
2010-07-05 11:29:24 +00:00
Daniel Reimer
9575756595 Remove one leftover which is not really needed. Thx to Samuel for kicking me to get my attention ;-)
svn path=/trunk/; revision=47943
2010-07-04 20:27:45 +00:00
Sylvain Petreolle
a4f8711e85 fix widl unix build.
svn path=/trunk/; revision=47942
2010-07-04 20:20:10 +00:00
Kamil Hornicek
273ff27b45 Update test lists for winetests too.
svn path=/trunk/; revision=47941
2010-07-04 19:57:31 +00:00
Daniel Reimer
35ea427b73 Update WIDL to Wine 1.2 rc6 + sync/modify two idl files making problems with the new widl. Patch by Samuel Serapion, tested by me
svn path=/trunk/; revision=47940
2010-07-04 19:52:38 +00:00
Daniel Reimer
29257b1ed2 Sync advapi32, gdi32, gdiplus, inetmib1, kernel32, mlang, msi, msvcrt, ntdll, oleaut32, rpcrt4, secur32, setupapi, shdocvw, shlwapi, snmpapi, twain_32, urlmon, user32, userenv, usp10, winhttp, wininet, wintrust, ws2_32 winetests to Wine 1.2rc6
svn path=/trunk/; revision=47939
2010-07-04 19:08:47 +00:00
Daniel Reimer
7177af5502 Another updated wine header to fix some synched winetest's build process.
svn path=/trunk/; revision=47938
2010-07-04 19:06:38 +00:00
Matthias Kupfer
c7119e7226 Katayama Hirofumi MZ <katayama DOT hirofumi DOT mz AT gmail DOT com>
- Preperation of quick preview für themes.
- See issue #5487 for details.

svn path=/trunk/; revision=47937
2010-07-04 16:40:03 +00:00
Eric Kohl
d9e47e9039 [ADVAPI32/LSASRV]
- Implement LookupPrivilegeNameW and LsaLookupPrivilegeName.
- Move lookup code from LookupPrivilegeNameW and LsarLookupPrivilegeValue into a separate file.

svn path=/trunk/; revision=47936
2010-07-04 12:51:39 +00:00
Daniel Reimer
d757f2ea25 Some more psdk updates needed for winetests.
svn path=/trunk/; revision=47935
2010-07-04 00:30:37 +00:00
Eric Kohl
66f17acd8f [ADVAPI32/LSASRV]
- Implement LookupPrivilegeValueW and LsaLookupPrivilegeValue.
- Move lookup code from LookupPrivilegeValueW to LsarLookupPrivilegeValue.

svn path=/trunk/; revision=47934
2010-07-03 22:51:44 +00:00
Daniel Reimer
35deb4dbb9 Update libxml to 2.7.7
Resync zlib to 1.2.5.
Patch by Samuel Serapion and some lil includes cleanup by me.

svn path=/trunk/; revision=47933
2010-07-03 22:34:05 +00:00
Daniel Reimer
a15dcc4250 Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here

svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
Daniel Reimer
74b08b2f54 Sync aclui, advapi32, atl, authz, kernel32, msi, oledlg, powrprof, qmgr, riched20, samlib to Wine 1.2rc5
Update some psdk Headers to get some more synched winetests build

svn path=/trunk/; revision=47930
2010-07-03 12:42:55 +00:00
Michael Martin
c11b4add2f [win32k]
- Remove old win32k timer code.

svn path=/trunk/; revision=47929
2010-07-03 12:37:51 +00:00
Michael Martin
6027c26e60 [win32k]
- Forgotten in r47924. Change name of BOOL parameter for UserSetCursorPos to better describe its purpose as done in c source.

svn path=/trunk/; revision=47927
2010-07-03 11:46:08 +00:00
Michael Martin
cfc7748e23 [usb/usbehci]
- Implement FdoDispatchInternalDeviceControl and remove IrpStub as its no longer needed.
- Implement Direct Call RemoveUsbDevice.
- Implement URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE.
- Use the port parameter in ExecuteControlRequest.
- Windows now identifies my thumb drive as a mass storage device.

svn path=/trunk/; revision=47926
2010-07-03 11:40:58 +00:00
Michael Martin
e769090231 [win32k]
- Revert changes done in 47325 which partially broke mouse hooks.
- If the UserSetCursorPos is reached due to SetCursorPos, dont generate a mouse move message or call mouse hooks.

svn path=/trunk/; revision=47924
2010-07-02 10:49:11 +00:00
Daniel Reimer
f403974604 Partially revert dnsapi changes as demanded by Samuel Serapion.
Update the banner.bmp in credui.

svn path=/trunk/; revision=47922
2010-07-01 14:00:03 +00:00
Johannes Anderwald
f2d29b70d7 [KS]
- Fix bogus debug print leading to buffer overflow

svn path=/trunk/; revision=47921
2010-07-01 11:59:42 +00:00
Daniel Reimer
913e2d6b7f Sync avifil, credui, crypt32, cryptdlg, cryptui, dnsapi, gdiplus, hhctrl, hnetcfg, iccvid, imaadp32, imm32, jscript, localspl, localui, mapi32, mciavi32, mcicda, mciqtz32, mciseq, mciwave, mshtml, msrle32, msvfw32, msvidc32, msxml3, oleacc, oleaut32 to Wine 1.2rc5 (Samuel Serapion, small changes by me)
Remove Esperanto and Walon languages from comctl32, comdlg32, mpr, msi, shlwapi, wininet

svn path=/trunk/; revision=47920
2010-07-01 11:09:47 +00:00
Daniel Reimer
247f3945f9 Ukrainian translation Updates (Igor Paliychuk)
svn path=/trunk/; revision=47919
2010-07-01 08:08:04 +00:00
Amine Khaldi
5a8354d8ed [PSDK]
- Fix EVENT_FILTER_DESCRIPTOR redefinition.

svn path=/trunk/; revision=47918
2010-06-30 19:36:36 +00:00
Matthias Kupfer
dd54fd1837 - move set of msg-time (for messages) back to msg queue (msg time is needed for all mouse events not only mouse move)
- ClickLock will work again

svn path=/trunk/; revision=47917
2010-06-30 18:40:20 +00:00
Sylvain Petreolle
576026667c Fix typo.
Dedicated to Physicus

svn path=/trunk/; revision=47916
2010-06-30 17:19:23 +00:00
Michael Martin
ba87cb4d4d [win32k]
- Remove dead code as in the old SetTimer and KillTimer functions.

svn path=/trunk/; revision=47915
2010-06-30 11:00:21 +00:00
Daniel Reimer
c533c98d1c Added Fox Audio Player to rapps and some more fixes. (Igor Paliychuk, myself)
svn path=/trunk/; revision=47914
2010-06-30 10:19:30 +00:00
Daniel Reimer
e0887a8e63 Add Visual C++ 2008 SP1 runtime to rapps and rename the others correctly.
svn path=/trunk/; revision=47913
2010-06-30 07:15:16 +00:00
evb
23b4ebaf89 Implemented IRP dispatch to work in new PCI driver (PciDispatchIrp), fill out FDO IRP handlers which all stubs now, make up/down-call work (PciPassIrpFromFdoToPdo, PciPassDownIrp)
Added the helper debug routines
PCI driver receive IRP_QUERY_INTERFACE now and hit stub


svn path=/trunk/; revision=47912
2010-06-30 01:39:21 +00:00
James Tabor
0a31855a87 [Win32k]
- Set caret blink rate for global server information too.

svn path=/trunk/; revision=47911
2010-06-29 22:13:13 +00:00
Johannes Anderwald
e8f968cbaa [PORTCLS]
- Check if there is a silence buffer available when there is no audio mapping available
- ignore failure for allocation requirements

svn path=/trunk/; revision=47909
2010-06-29 21:14:09 +00:00
Sir Richard
1ebaa1cc0b [PCIX]: Fix 17 different bugs in the new PCI driver. ACPI and PCI IRQ Routing table detection now works, ACPI table mapping doesn't crash anymore, PciGetRegistryValue doens't always fail, some DPRINTs fixed, added missing "continues", "breaks", and early-"returns". Fixed missing, or extra "!"s. If you're going to try being clever with do while FALSE loops, get 'em right!
The driver now works up to the point where eVb has last committed his code.

svn path=/trunk/; revision=47908
2010-06-29 20:21:45 +00:00
Sir Richard
ec783fe1df [RTL]: RangeList APIs should not be allocating pool with a tag of 0, since this makes the checked kernel ASSERT. Good thing nobody used these APIs (I wonder if they even work), but eVb's PCI driver now does.
svn path=/trunk/; revision=47907
2010-06-29 19:23:16 +00:00
Michael Martin
c95cec3745 [win32k]
- Change percision of win32k timers to 0.5 miliseconds.
- Remove Destroy parameter from FindTimer as it is just odd and call RemoveTimer where needed.
- PostTimerMessages: No need to continue looping the remainder of the timers once the target timer has been found and message posted to message queue.

svn path=/trunk/; revision=47906
2010-06-29 14:37:52 +00:00
Gabriel Ilardi
23e550f75e [EVENTVWR]
- Polish update by Maciej Bialas.

svn path=/trunk/; revision=47905
2010-06-29 10:29:30 +00:00
Daniel Reimer
a1b90e2497 Update Thunderbird and FireFox in rapps.
svn path=/trunk/; revision=47902
2010-06-29 06:31:00 +00:00
Timo Kreuzer
f2d9480a4f [WS2_32_NEW]
Fix WSAAccept parameter (DWORD -> DWORD_PTR)

svn path=/trunk/; revision=47901
2010-06-28 21:36:28 +00:00
Timo Kreuzer
b40e7f0e03 [WINMM]
Fix a number of 64bit issues, add some comments where the code is not 64 bit safe. This module should be synced with wine, but this still causes a problem with Flash videos on FF2 (likely another timer problem)

svn path=/trunk/; revision=47900
2010-06-28 20:58:30 +00:00
Cameron Gutman
e49b6bfe34 [DHCPCSVC]
- Discover adapters synchronously again until a bug (possibly a race condition) is fixed
- DHCP failure in certain situations is fixed now

svn path=/trunk/; revision=47899
2010-06-28 18:50:19 +00:00
evb
6d5d099e85 Implement Root Bus FDO AddDevice codes, get boot config, connect to HAL or ACPI config handlers (PciQueryForPciBusInterface, PciGetConfigHandlers), read BUS FDO hack flag, get _HPP HotPlug PCI ACPI data and initialize arbiter support.
PciGetHotPlugParameters work but no PCI HotPlug support on my machines, so cannot test ACPI data, that part stub now
Add PciFdoDispatchTable, PciFdoDispatchPnpTable, PciFdoDispatchPowerTable but all stub to PciIrpNotSupported however set correct IRP Dispatch Style for the IRPS
Arbiter support in PciInitializeARbiters done, but PciInterfaces array is NULL (stub) at moment
Add PCI_SIGNATURE, PCI_STATE, PCI_DISAPTCH_STYLE type, add PciInitializeState to begin the state support
Add structure for PCI_FDO_EXTENSION, PCI_SECONDARY_EXTENSION, PCI_INTERFACE, PCI_ARBITER_INSTANCE, PCI_DISPATCH_TABLE
PCI utility functions added: PciFindParentPciFdoExtension, PciInsertEntryAtTail, PciInsertEntryAtHead, PcipLinkSecondaryExtension, PciGetDeviceProperty, PciSendIoctl
Need sir_richard to add arbiter.h header to define ARBITER_INSTANCE for finish support
This 1000 more codes done now~

svn path=/trunk/; revision=47898
2010-06-28 17:30:35 +00:00
evb
ce6c5dd121 Missing PCI_BUS_DRIVER_INTERNAL added to bugcodes. Thx for sir_richard to show me how to add.
svn path=/trunk/; revision=47897
2010-06-28 17:21:16 +00:00
Sylvain Petreolle
f5a06bcb50 Fix midiOutOpen and midiInOpen prototypes.
svn path=/trunk/; revision=47896
2010-06-28 16:59:17 +00:00
Michael Martin
c4915f13f1 [win32k]
- Only the CompletionCallback member determines if a callback is needed. Checking the SenderReturn is unwanted and this variable was never initialized which could cause bogus callback attempts. Just remove the BOOL variable SenderReturned and directly check if Message->DispatchingListEntry.Flink is NULL before attempting to remove the message from senders queue.  Noticed by Timo.

svn path=/trunk/; revision=47895
2010-06-28 12:05:49 +00:00
evb
1d4fa18cdc Begin implement full PCI Bus Driver. code by me comments by sir_richard to avoid Engrish
DriverEntry full 100% implemented, ACPI WatchDog detect, PCI IRQ Routing detect, PCI errata/hackflag detect (PciGetDebugPorts not support, need PCI Debug Device to test)
Native (S)ATA, PCI BIOS Resource Lock, System Errata/Hackflag also is detect
HAL Hoooking enabled, callbacks stub
Stub PnP Interfaces: PciAddDevice, PciDriverUnload, PciDispatchIrp
PCI utility routines: PciUnicodeStringStrStr, PciStringToUSHORT, PciIsSuiteVersion, PciIsDatacenter, PciOpenKey, PciGetRegistryValue, PciBuildDefaultExclusionList done
PCI Verifier Support for future: PciVerifierInit/PciVerifierProfileChangeCallback (stub)
Thank you for much patience~ This 1200 first codes, have 12000 codes more to come!~~


svn path=/trunk/; revision=47894
2010-06-28 05:23:31 +00:00
Sir Richard
e1b8cfb906 [NDK]: Add some missing RTL Range Functions needed by eVb.
svn path=/trunk/; revision=47893
2010-06-28 04:26:18 +00:00
Sir Richard
2f23c40c67 [ACPI]: Share ACPI table structures and NT-specific registry data in a shared, internal ACPI header, instead of HAL's internal headers, because FreeLDR, the kernel's PnP Manager, the PCI Bus Driver and the ACPI Driver all need access to these types as well.
svn path=/trunk/; revision=47892
2010-06-28 04:25:38 +00:00
Timo Kreuzer
641c5d6ab8 [WINEMP§.ACM]
Define WIN32 to fix compilation for anything else than x86

svn path=/trunk/; revision=47891
2010-06-28 02:56:08 +00:00
Timo Kreuzer
e1ba256aed [WINED3D]
Fix prototype of wined3d_event_query_supported (BOOL != HRESULT)

svn path=/trunk/; revision=47890
2010-06-28 02:27:53 +00:00
Timo Kreuzer
c2da054c20 usurp: Physicus: better use </if> in .rbuild ;)
So be it.

svn path=/trunk/; revision=47889
2010-06-28 01:29:27 +00:00
Timo Kreuzer
c0cf67d988 build w32knapi only for x86
svn path=/trunk/; revision=47888
2010-06-28 00:32:35 +00:00
Sir Richard
55c95b78f9 [PCI]: Add pciclass.rc to use the pciclass.mc/res-generated file by MC. eVb can now start committing his driver.
svn path=/trunk/; revision=47887
2010-06-28 00:02:20 +00:00
Sir Richard
079e15a99e [PCI]: Add PCI IRQ Routing Table structure to Shared, Internal PCI Header (based off the Microsoft Spec and the Apple SMBIOS Header).
[PCI]: Remove HAL-internal PCI definitions from the existing "Shared/Internal" PCI Header which existed in NTOS's private include directory, and move them to HAL-internal headers.
[PCI]: Remove remaining shared PCI definitions from that same header, and put them in the new Shared/Internal PCI Header.
[PCI]: Remove duplicated PCI definitions from FreeLDR, and use thw new Shared/Internal PCI Header.

svn path=/trunk/; revision=47886
2010-06-27 23:54:47 +00:00
Sir Richard
cdbd59e260 [PCI]: Add the PCI_ENABLE_BRIDGE definitions that can be present in PCI_COMMON_CONFIG/type1/BridgeControl. Microsoft does not document these in the public PCI headers, but the definitions were found in the Singularity headers. eVb's PCI driver uses these.
svn path=/trunk/; revision=47885
2010-06-27 22:22:34 +00:00
Timo Kreuzer
9322109bcf [USER32]
Merge from amd64 branch:

36987:
- Fix user32 compilation errors. (Samuel Serapion)
36988:
- Make user32 compile and link by defining Get/SetClass/WindowLongPtrA/W (Stefan Ginsberg)
41480:
- Fix 64bit issues, add a wine compatibility hack (Timo Kreuzer)
41540:
- Make parameters for NtUserCallOneParam and NtUserCallTwoParam DWORD_PTR instead of DWORD (Timo Kreuzer)
43965:  (Samuel Serapion)
- Fix several user32 warnings.
- Sync GetWindow*A/W with wine and unify all versions, commenting out a wine hack.
- As a bonus implement GetWindowLongPtrA/W.
- Tested to work in trunk.
43992:
- Fix user32 build.  (Samuel Serapion)
45124:
- Fix user32 build. (Samuel Serapion)
47472:
- Remove wine hack and allow user32 to compile again. (Samuel Serapion)
47878: (Timo Kreuzer)
- Use UlongToHandle instead of LongToHandle
- case to ULONG_PTR instead of using HandleToUlong
- SetSysColorsTemp: don't truncate the pointer sized n value, remove a comment
- IntGetClsWndProc: fix a bug
- IntGetWindowLong: pass !unicode to IntGetWndProc
47882:
- Make the uiLo and uiHi members of the KMDDELPARAM structure UINT_PTRs (Timo Kreuzer)

svn path=/trunk/; revision=47884
2010-06-27 22:19:17 +00:00
Sir Richard
66bec4f5b8 [PCI]: Add the 40 different PCI erratas ("hack flags") that Windows can apply to broken PCI devices. eVb's driver knowss to apply these by parsing the PCI\Parameters list. These are the actual internal symbolic names used by Microsoft, which accidentally leaked out in the Vista Errata Manager .INF file.
svn path=/trunk/; revision=47883
2010-06-27 22:17:37 +00:00
Sir Richard
495536ab69 [BOOTDATA]: Add the 176 different PCI devices that Windows knows about, and the erratas that need to be applied to make those devices work correctly. This information is processed by eVb's PCI Bus driver. 3rd-party device manufacturers, as well as Microsoft online support pages, sometimes instruct users to add new entries to this list as well, and new entries are also added by 3rd-party driver .INF files. Probably 30% of computers in the world have at least one of these devices installed.
svn path=/trunk/; revision=47881
2010-06-27 22:12:00 +00:00
Amine Khaldi
b3d42ba099 Fix a warning (treated as an error).
svn path=/trunk/; revision=47879
2010-06-27 21:37:42 +00:00
Sir Richard
12d80eeec0 [NDK]: Not Alex, not 2006, not February (27th, though), not Power Management.
svn path=/trunk/; revision=47876
2010-06-27 21:19:46 +00:00
Aleksey Bragin
5794cf44f1 [NTOS]
- Warn only once in MmSecureVirtualMemory/MmUnsecureVirtualMemory, like it was done in 47864.

svn path=/trunk/; revision=47875
2010-06-27 21:18:59 +00:00
Amine Khaldi
e53a466981 Fix Build. Seriously this time ;)
svn path=/trunk/; revision=47874
2010-06-27 21:11:57 +00:00
Sir Richard
86f4c22185 [NTOS]: VfFailDeviceNode is actuall __cdecl.
[NTOS]: Sort, update, clean-up, and add descriptions to bugcodes.mc.

svn path=/trunk/; revision=47873
2010-06-27 21:02:20 +00:00
Sir Richard
2ab1f8b0d4 [NTOS]: Add "vf" NTOS component, required NDK headers, and enable exports required for PCI driver to load.
svn path=/trunk/; revision=47872
2010-06-27 20:47:52 +00:00
Sir Richard
26f62038b8 [NTOS]: I am sorry, this is embarssing. Fix build again.
svn path=/trunk/; revision=47871
2010-06-27 20:45:15 +00:00
Pierre Schweitzer
d80d711832 Fix ARM build
svn path=/trunk/; revision=47870
2010-06-27 20:44:47 +00:00
Sir Richard
dca7e2a102 [NTOS]: My SVN is haunted. Commit missing changes?
svn path=/trunk/; revision=47869
2010-06-27 20:38:12 +00:00
Eric Kohl
4c932f1485 [NTOSKRNL]
NtDuplicateToken: Fail, if TokenType is neither TokenImpersonation nor TokenPrimary.

svn path=/trunk/; revision=47868
2010-06-27 20:13:44 +00:00
Sir Richard
9d9fede96c [MC]: Add pciclass.mc required for eVb's PCI driver. Matches resource data in Windows driver, minus typos.
svn path=/trunk/; revision=47867
2010-06-27 20:08:38 +00:00
Cameron Gutman
f4530b30f2 [DHCPCSVC]
- Use an event to signal when an adapter has been added

svn path=/trunk/; revision=47866
2010-06-27 20:05:52 +00:00
Sir Richard
763a24d9d7 - There's no such thing as PRTL_MESSAGE_RESOURCE_ENTRY, use PMESSAGE_RESOURCE_ENTRY instead.
svn path=/trunk/; revision=47865
2010-06-27 19:56:57 +00:00
Sir Richard
626e3e7295 [NTOS]: Warn only once about MmLockPageableImageSection being unimplemented.
svn path=/trunk/; revision=47864
2010-06-27 19:55:36 +00:00
Cameron Gutman
91aa625c40 [MSAFD]
- Handle the case (again) where we get passed an invalid lpErrno pointer to a WSP function
- Fixes some crashes I encountered when running Opera 9

svn path=/trunk/; revision=47863
2010-06-27 17:21:03 +00:00
Timo Kreuzer
b51143af5f The Win32ClientInfo TEB field can be bigger than the CLIENTINFO structure.
svn path=/trunk/; revision=47862
2010-06-27 15:20:34 +00:00
Sylvain Petreolle
0cd695d643 update olepro32 base address.
svn path=/trunk/; revision=47860
2010-06-27 13:26:22 +00:00
Michael Martin
429fe0b64c [win32k]
- Add Check for spwndNext being null before accessing any of the members. Fixes bugcheck when using cubicexplorer.

svn path=/trunk/; revision=47859
2010-06-27 12:36:23 +00:00
Gabriel Ilardi
4203b20f25 [EVENTVWR]
- Update Italian and Spanish translations

svn path=/trunk/; revision=47858
2010-06-26 22:14:07 +00:00
Sylvain Petreolle
9b17ccc624 french translation for eventvwr
svn path=/trunk/; revision=47857
2010-06-26 21:51:29 +00:00
Eric Kohl
e946994785 [EVENTVWR]
- Replace hard-coded column names by string resources.

svn path=/trunk/; revision=47856
2010-06-26 19:55:05 +00:00
Daniel Reimer
fe430b6d23 Update WineFile to Wine 1.2rc5
svn path=/trunk/; revision=47855
2010-06-26 14:07:37 +00:00
Daniel Reimer
195cab6a79 Update reg, xcopy, winhlp32, wordpad to Wine 1.2rc5
svn path=/trunk/; revision=47854
2010-06-26 13:56:41 +00:00
Timo Kreuzer
3be89c6184 [USER32]
ntstatus.h is in psdk, not in ddk folder.
(How did this work?)

svn path=/trunk/; revision=47853
2010-06-26 11:03:09 +00:00
Timo Kreuzer
6965f5f1f5 [DDK/XDK]
Don't auto define NO_LEGACY_DRIVERS on reactos x64 builds.

svn path=/trunk/; revision=47852
2010-06-26 10:27:25 +00:00
Eric Kohl
3c656ee009 [FORMATTING]
- Fix indentation.

svn path=/trunk/; revision=47851
2010-06-26 09:50:41 +00:00
Eric Kohl
84ab81fe4b [NTDLL]
- Add RtlCreateBootStatusDataFile() stub.

svn path=/trunk/; revision=47850
2010-06-26 09:49:31 +00:00
Michael Martin
bc5e79f42d [win32k]
- co_IntSendMessageWithCallBack is called for two reasons; for messages that originate from win32k and from user mode when using Callbacks.
For both cases do not do anything with the sendqueue member of message struct and do not add the message to the senders dispatch message list.
- In msgqueue related functions, check if the message is a nowait messages before attempting to remove and entry from the dispatch message list as it doesnt exist.
- Fixes a NonPagedPool corruption that was occurring on regtest bootcd. Thanks Caemyr for testing.

svn path=/trunk/; revision=47849
2010-06-26 09:15:32 +00:00
Timo Kreuzer
5b46128dfb [UNIATA]
Merge from amd64 branch:
44634: Make x86 specific optimizations x86 specific, use macros otherwise. (Samuel Serapion)
44639: Try to fix numerous pointer to ULONG casts. (Samuel Serapion)
47846/47847: Remove all the byteswap "optimisations" and use portable RTL byteswap functions (Timo Kreuzer)

svn path=/trunk/; revision=47848
2010-06-26 00:15:24 +00:00
Michael Martin
f4962e7c69 [usbehci]
- Use the correct offset of ROOTHUB2_CONFIGURATION_DESCRIPTOR and ROOTHUB2_INTERFACE_DESCRIPTOR to calculate needed buffer sizes. Fixes a buffer overflow crash.

svn path=/trunk/; revision=47845
2010-06-25 15:50:26 +00:00
Timo Kreuzer
c3b4cac97a [SUSPEND]
Fix compilation for amd64

svn path=/trunk/; revision=47844
2010-06-25 01:37:58 +00:00
Amine Khaldi
4f5e43f00e [PSDK]
- Add several missing VER_* definitions.

svn path=/trunk/; revision=47843
2010-06-24 22:23:02 +00:00
Johannes Anderwald
e4ee2cb533 [WDMAUD.DRV]
- Fix initialization of mmixer library

svn path=/trunk/; revision=47842
2010-06-24 11:18:16 +00:00
Johannes Anderwald
83357c470d [WDMAUD.DRV]
- Fix compilation when using USE_MMIXER_LIB #2

svn path=/trunk/; revision=47841
2010-06-24 10:54:58 +00:00
Johannes Anderwald
6aa532398f [WDMAUD.DRV]
- Fix compilation when using USE_MMIXER_LIB

svn path=/trunk/; revision=47840
2010-06-24 10:52:46 +00:00
Daniel Reimer
b8fd2e11e1 Ukrainian translation updates for usetup by Igor Paliychuk.
svn path=/trunk/; revision=47839
2010-06-23 22:38:12 +00:00
Timo Kreuzer
5e4ab4ede7 [SCSIPORT]
- undefine macros that are defined by DDK headers, before implementing the functions
- add missing definitions for amd64

svn path=/trunk/; revision=47838
2010-06-23 21:06:00 +00:00
Pierre Schweitzer
22576dee05 [IOEVENT]
Added a library containing GUIDs for PnP notifications

[BUGCODES]
Added missing bugcheck code for PnP manager

[NTOSKRNL]
- Implemented FsRtlNotifyVolumeEvent()
- Implemented IoReportTargetDeviceChange(), IoReportTargetDeviceChangeAsynchronous()
- Craplemented PpSetCustomTargetEvent() to match our actual PnP manager notifications system. This is to be rewritten
- Added support for custom notifications in IopNotifyPlugPlayNotification()
- Added use of FsRtlNotifyVolumeEvent() in RawUserFsCtrl() to notify volume state changes
- Added use of IoEvent library to ntoskrnl

[FASTFAT]
- Added use of FsRtlNotifyVolumeEvent() when successfully mounting a volume

Finally, purpose of that patch is to implement volumes events notifications. Behaviour and implementation is correct till PpSetCustomTargetEvent(). The PnP notifications manager should be rewritten to match Microsoft's one. Furthermore, it appears that in Windows, those notifications are asynchronous.

svn path=/trunk/; revision=47837
2010-06-23 19:37:22 +00:00
Timo Kreuzer
bbbbb74fd5 [PRIMITIVES]
- use pointer sized integers when converting handles

svn path=/trunk/; revision=47832
2010-06-23 12:40:55 +00:00
Timo Kreuzer
0959625c7e [OSKITTCP]
Use RtlUlongByteSwap / RtlUshortByteSwap for byte swapping. They are portable and intrinsics on x86.

svn path=/trunk/; revision=47831
2010-06-23 11:37:39 +00:00
Daniel Reimer
6b1edeb54a Add Ukrainian Translations to rapps by Igor Paliychuk.
Update VLC to 1.1.0

svn path=/trunk/; revision=47830
2010-06-22 21:02:37 +00:00
Pierre Schweitzer
bbb19308ea [NTOSKRNL]
Move the PDO check in IoOpenDeviceRegistryKey() to the function begin.
Requested by sir_richard.

svn path=/trunk/; revision=47829
2010-06-22 18:51:22 +00:00
Pierre Schweitzer
0ad7647067 [NTOSKRNL]
Add a macro to check for a valid PDO and use it in IoOpenDeviceRegistryKey().
Requested by sir_richard.

svn path=/trunk/; revision=47828
2010-06-22 18:47:22 +00:00
Cameron Gutman
b362a62a7e [NTOSKRNL]
- Check that the caller passed a valid PDO pointer to IoOpenDeviceRegistryKey

svn path=/trunk/; revision=47827
2010-06-22 15:53:52 +00:00
Daniel Reimer
6d3e9528cf Added comctl32.ocx, KDEWin, Mono, .net, Media Player Classic, Python, Steam, Tahoma Font and Windows Media Encoder 9 to rapps.
Updated VB6, VC2005, VC2008 links according to winetricks.

svn path=/trunk/; revision=47826
2010-06-22 07:27:43 +00:00
Cameron Gutman
f840fe0a50 [NDIS]
- Dequeue the timer earlier so the timer queue will be in a valid state if any timers are modified during the miniport's timer callback

svn path=/trunk/; revision=47825
2010-06-22 05:37:31 +00:00
Timo Kreuzer
34b41a733c [ODBC32]
Merge 41027, 41028, 44611 from amd64 branch
Update odbc32 to Wine-1.1.21.

svn path=/trunk/; revision=47824
2010-06-21 23:14:01 +00:00
Kamil Hornicek
1890649387 [NTOSKRNL]
Remove a superfluous assert (requested by sir_richard).

svn path=/trunk/; revision=47823
2010-06-21 21:42:12 +00:00
Timo Kreuzer
cfb8a35516 [CRT]
- Stubplement _controlfp_s, rand_s
- Implement _invalid_parameter, _get_invalid_parameter_handler, _set_invalid_parameter_handler
- Implement memmove_s, strncpy_s
- sync heap.c with wine
Patch by Samuel Serapion

svn path=/trunk/; revision=47822
2010-06-21 19:57:36 +00:00
Timo Kreuzer
dc9cecc4cd [NTOSKRNL]
Apply compilation fix for amd64

svn path=/trunk/; revision=47821
2010-06-21 19:15:21 +00:00
Daniel Reimer
98ba13ab43 Update the rapps download list.
Fix the SeaMonkey Mirror.

svn path=/trunk/; revision=47820
2010-06-21 19:04:09 +00:00
Johannes Anderwald
3da5d96351 [PORTCLS]
- Use FreeItem function for freeing memory instead of doing it directly

svn path=/trunk/; revision=47819
2010-06-21 18:56:30 +00:00
Johannes Anderwald
4186c83e7b [PORTCLS]
- Add sanity checks

svn path=/trunk/; revision=47817
2010-06-21 14:25:44 +00:00
Sylvain Petreolle
fa19c99aca Update base address of comdlg32.
svn path=/trunk/; revision=47816
2010-06-21 14:00:55 +00:00
Cameron Gutman
e36497a708 [NTOSKRNL]
- Resource translation isn't very effective when we don't store the translated value in the translated descriptor (Fix a typo)

svn path=/trunk/; revision=47815
2010-06-21 04:36:32 +00:00
Johannes Anderwald
b1560aa3f4 [PORTCLS]
- Fix bug in the resource list object

svn path=/trunk/; revision=47814
2010-06-20 21:17:43 +00:00
Johannes Anderwald
47904efaa6 [PORTCLS]
- Support IDrmPort / IDrmPort2 for IPortWavePci driver

svn path=/trunk/; revision=47813
2010-06-20 20:58:24 +00:00
Timo Kreuzer
1a1f6cb2d4 [MSVCRT]
bring back _swprintf export

svn path=/trunk/; revision=47812
2010-06-20 19:20:55 +00:00
Timo Kreuzer
72ad57b2de [MSVCRT]
Convert to spec. Patch by Samuel Serapion.

svn path=/trunk/; revision=47811
2010-06-20 18:04:49 +00:00
Eric Kohl
317e5d113f [NETEVENT]
- Add new netevent.dll. It is a resource dll that will be used by the event log viewer.

svn path=/trunk/; revision=47810
2010-06-20 14:58:29 +00:00
Jérôme Gardou
6b0ac7a880 apply 46848 from yarotows
[WIN32K]
    - get rid of ROS_DC::BitsPerPixel.
1 - It was a hack.
2 - Its use was inconsistent.

svn path=/trunk/; revision=47809
2010-06-20 13:11:23 +00:00
Kamil Hornicek
e87aee9b6c Reshuffle .rbuild entries so we have all files grouped by directories and in alphabetical order.
svn path=/trunk/; revision=47808
2010-06-20 12:37:12 +00:00
Johannes Anderwald
b723c54434 [PORTCLS]
- Check if resource list is provided
- Fixes a crash for irc:igorko

svn path=/trunk/; revision=47807
2010-06-19 15:56:09 +00:00
Johannes Anderwald
bb28f2cb1a [PORTCLS]
- Fix buffer overflow

svn path=/trunk/; revision=47805
2010-06-19 07:43:45 +00:00
Johannes Anderwald
4da45c3ff1 [SYSAUDIO]
- Perform all allocations / frees in dedicated alloc / free function

svn path=/trunk/; revision=47804
2010-06-19 07:26:20 +00:00
Cameron Gutman
135340e065 [MSAFD]
- Add locking to protect the socket list

svn path=/trunk/; revision=47803
2010-06-19 05:04:40 +00:00
Jérôme Gardou
a8c547f091 Merge 47800 from yarotows branch.
Changelog should have been:
[GDI32]
  - Use default LOGFONT in EnumFontFamilies if none is given.
+ ~3000 gdi32:font winetests

svn path=/trunk/; revision=47802
2010-06-18 22:46:34 +00:00
Cameron Gutman
b00db8b8a6 [NTOSKRNL]
- Fix a string termination bug in the device interface code
- Thanks to janderwald for spotting the bug

svn path=/trunk/; revision=47801
2010-06-18 21:57:07 +00:00
Eric Kohl
e5bc385e89 [NTOSKRNL]
- Use the current partition descriptor to check for container partitions. Logical units in extended partitions become visible again but you cannot access them yet.
This fixes the first half of bug #2564.

svn path=/trunk/; revision=47799
2010-06-17 19:41:52 +00:00
Jérôme Gardou
57d80a50d5 [WIN32k]
- Chek if there is something to do in GDIOBJ_SetOwnership before doing it

svn path=/trunk/; revision=47788
2010-06-16 18:47:04 +00:00
Jérôme Gardou
1a601ba9e5 [WIN32K]
- Set DC_DIBSECTION dirty flag when a DIB section is selected, not when one is created.

svn path=/trunk/; revision=47787
2010-06-16 16:59:29 +00:00
Johannes Anderwald
e3b34383eb [PORTCLS]
- Fix infinite loop
- Should fix gabriel_it and igorko1 problem with KsStudio
- Add more debugging code to DumpFilterDescriptor

svn path=/trunk/; revision=47786
2010-06-16 15:41:41 +00:00
Johannes Anderwald
3c7fdc3dfa [PORTCLS]
- Return better return code for unimplemented feature

svn path=/trunk/; revision=47785
2010-06-16 14:14:33 +00:00
Eric Kohl
ca3bc68834 [SYSSETUP]
Set registry values 'PathName' and 'SystemRoot' in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion.
This fixes bug #4414.

svn path=/trunk/; revision=47784
2010-06-15 19:31:19 +00:00
Johannes Anderwald
3072b5dec6 [PORTCLS]
- Add sanity check

svn path=/trunk/; revision=47783
2010-06-15 17:29:43 +00:00
Johannes Anderwald
d6f80bd4d4 [MMIXER]
- Fix buffer overflow
- Dedicated to irc:igorko

svn path=/trunk/; revision=47782
2010-06-15 14:04:19 +00:00
Gabriel Ilardi
981690481a [REGEDIT]
- Implement hex editing. Patch by Katayama Hirofumi.
See issue #5447 for more details.

svn path=/trunk/; revision=47781
2010-06-15 10:28:01 +00:00
Kamil Hornicek
b20e4f29cd [OPENGL32]
Fixes for ICD reference counting. By Jerome Gardou
See issue #5257 for more details.

svn path=/trunk/; revision=47780
2010-06-14 13:11:51 +00:00
Kamil Hornicek
8563362b72 [OPENGL32_WINETEST]
Add opengl32 winetest, patch by Jerome Gardou.
Not used for now.

svn path=/trunk/; revision=47779
2010-06-14 12:41:15 +00:00
Daniel Reimer
59ed163b9e Sync winefile to Wine 1.2 RC3
svn path=/trunk/; revision=47778
2010-06-14 10:49:56 +00:00
Daniel Reimer
5dbfbb5201 Sync reg, xcopy, iexplore, winhlp32, wordpad, write, msiexec with Wine 1.3 RC3
svn path=/trunk/; revision=47776
2010-06-13 23:05:40 +00:00
Amine Khaldi
efa449d6f5 [XDK]
- Deduplicate FSRTL_COMMON_FCB_HEADER_LAYOUT in ntifs.h
- Move ECP_HEADER from the ntifs template to fsrtltypes.h
[DDK]
- Update ntifs.h to reflect XDK changes.

svn path=/trunk/; revision=47775
2010-06-13 13:55:30 +00:00
Johannes Anderwald
ca3e5d2a88 [BDAPLGIN, MSDVBNP, MSVIDCTL, BDASUP]
- Disable building dvb stack untill ks has the required functionality

svn path=/trunk/; revision=47774
2010-06-13 13:08:15 +00:00
Johannes Anderwald
8a5845eee6 [SNDBLST_SYS]
- Disable building

svn path=/trunk/; revision=47773
2010-06-13 12:54:16 +00:00
Johannes Anderwald
f4c57cadb5 [DRIVERS]
- Disable building of SWENUM, MPU401, CMIDriver, SPLITTER, STREAM to reduce build time
- Those modules are either unused or don't work yet due to missing functionality



svn path=/trunk/; revision=47772
2010-06-13 12:49:04 +00:00
Timo Kreuzer
226e9212dd Add missing file
svn path=/trunk/; revision=47771
2010-06-13 01:32:13 +00:00
Timo Kreuzer
ec1169363d [CRT]
- CRT update part 1/x
- sync C++ / exception related CRT code with wine
- add support for non-underscored symbols
- Patch by Samuel Serapion, slightly modified by me

svn path=/trunk/; revision=47770
2010-06-13 01:24:42 +00:00
Sylvain Petreolle
828838704e [fbtusb]
Fix include casing.


svn path=/trunk/; revision=47769
2010-06-12 20:08:29 +00:00
Timo Kreuzer
17d39f4f25 [PSDK]
- ntstatus.h: add STATUS_INVALID_CRUNTIME_PARAMETER
- winnt.h: fix 64 bit definition of SLIST_ENTRY

svn path=/trunk/; revision=47768
2010-06-12 15:09:34 +00:00
Amine Khaldi
6d224b0735 - Add some missing file-headers.
svn path=/trunk/; revision=47767
2010-06-12 14:55:02 +00:00
Eric Kohl
212d2915d2 [USBD]
Replace DWORD by ULONG to make usbd.sys build without errors.

svn path=/trunk/; revision=47766
2010-06-12 12:20:41 +00:00
Eric Kohl
9cf8c2c8da [VFATLIB]
- Get rid of the hard-coded sector size as large sector (4KB) harddisks are already available.
- When a partition is formatted, choose the FAT type according to the partition type. The size of the partition does not matter here as it is up to the caller to set the right partition type according to its size.

svn path=/trunk/; revision=47765
2010-06-12 11:20:58 +00:00
Eric Kohl
0c8457631d [FORMATTING]
Fix indentation. No code changes.

svn path=/trunk/; revision=47764
2010-06-12 10:25:18 +00:00
Johannes Anderwald
78b0fb4a21 [WDMAUD_KERNEL]
- Fix possible buffer overflow
[MMIXER]
- Add sanity checks

svn path=/trunk/; revision=47763
2010-06-12 10:21:03 +00:00
Daniel Reimer
6688715df4 Bug 5457: updated slovak translations by Mario Kacmar.
svn path=/trunk/; revision=47762
2010-06-12 09:58:22 +00:00
Cameron Gutman
37323a84c9 [FBTUSB]
- Import the FreeBT USB generic bluetooth driver (abandoned)
- Some slight modifications to make it build
- WMI is currently commented out because our WMI headers are lacking (particularly wmistr.h)
- Not building by default for now

svn path=/trunk/; revision=47761
2010-06-12 00:29:09 +00:00
Cameron Gutman
f073c977ef [USBD]
- Fix the spec file
- Fixes usbd build

svn path=/trunk/; revision=47760
2010-06-12 00:23:18 +00:00
Timo Kreuzer
c9ac3e0337 [PSDK]
Fix a typo (_AMD64 -> _AMD64_)

svn path=/trunk/; revision=47759
2010-06-11 21:48:13 +00:00
Eric Kohl
91b72f72dc [FORMATTING]
Fix indentation. No code changes.

svn path=/trunk/; revision=47758
2010-06-11 21:21:27 +00:00
Amine Khaldi
750d89765c [XDK/DDK]
- Relax INTERLOCKED_RESULT inclusion guard.

svn path=/trunk/; revision=47756
2010-06-11 17:00:49 +00:00
Amine Khaldi
42d943893a [PSDK]
- Add some missing file-headers.

svn path=/trunk/; revision=47755
2010-06-11 13:52:46 +00:00
Johannes Anderwald
2c589bd133 [WDMAUD_KERNEL]
- Perform all allocations / frees in dedicated alloc / free function

svn path=/trunk/; revision=47754
2010-06-11 12:28:10 +00:00
Amine Khaldi
af25a406cf [PSDK]
- Copy atsmedia.h from our dxsdk to our psdk (replacing the one that's already there)
- Add some missing file-headers.

svn path=/trunk/; revision=47753
2010-06-11 12:10:58 +00:00
Gabriel Ilardi
1c5a1d20a1 [SHELL32]
- Correctly show accessed and modified times in file properties dialog (they were exchanged).

svn path=/trunk/; revision=47752
2010-06-11 09:13:49 +00:00
Eric Kohl
9291284ade [USETUP]
- Set the type of the install partition even if it was not created by usetup.
This fixes bug #4368.

svn path=/trunk/; revision=47751
2010-06-11 04:13:29 +00:00
Amine Khaldi
09d662004d [FRAGINATOR]
- Add Ukrainian translation.

Patch by Igor Paliychuk - igor-hkr[at]mail[dot]ru

svn path=/trunk/; revision=47750
2010-06-10 23:29:42 +00:00
Amine Khaldi
87c3d876c8 [BROWSEUI]
- Add Ukrainian translation.
[KERNEL32]
- Add Ukrainian translation.

Patch by Igor Paliychuk - igor-hkr[at]mail[dot]ru

svn path=/trunk/; revision=47749
2010-06-10 23:28:50 +00:00
Jérôme Gardou
03eab2765a [WIN32K]
Merge GDIOBJ related changes from yarotows
  - GDIOBJ_(Share)LockObj : return NULL on NULL input, avoiding debug spew
  - Set NULL process owner when setting READY_TO_DIE flag of a gdiobj
  - So now GDIOBJ_ShareUnlockObj can claim ownership before trying to delete the object

svn path=/trunk/; revision=47748
2010-06-10 22:15:05 +00:00
Gregor Schneider
14ccdeece6 [WIN32K] Use GDITAG_RBRUSH instead of hardcoding the tag
svn path=/trunk/; revision=47745
2010-06-10 20:45:58 +00:00
Amine Khaldi
a47afb4b46 [PSDK]
- Move the amd64 check before the i386 one, and also check for __i386__

svn path=/trunk/; revision=47744
2010-06-10 20:31:21 +00:00
Gregor Schneider
ae1afc8ba7 [WIN32K] Tag the remaining untagged pool allocations
svn path=/trunk/; revision=47743
2010-06-10 19:58:39 +00:00
Gregor Schneider
31de1284d4 [WIN32K]
- Tag even more pool allocations
- Remove dead code, adjust comments

svn path=/trunk/; revision=47742
2010-06-10 19:33:04 +00:00
Gregor Schneider
fdec1db734 [WIN32K] Tag more pool allocations
svn path=/trunk/; revision=47741
2010-06-10 19:20:57 +00:00
Pierre Schweitzer
80722c4d1f [NETSHELL]
Updated French translation

[PAINT]
Updated French translation

[SHELL32]
Updated French translation

[SPIDER]
Added French translation

[SYSSETUP]
Updated French translation

svn path=/trunk/; revision=47740
2010-06-10 18:58:46 +00:00
Amine Khaldi
ef171ff013 [USER32_WINETEST]
- Re-enable generated.c tests.
This commit (the previous one too) is a result of the header work reintegration.

svn path=/trunk/; revision=47738
2010-06-10 16:06:10 +00:00
Amine Khaldi
6802044fdd [NTDLL_WINETEST]
- Re-enable generated.c tests.

svn path=/trunk/; revision=47737
2010-06-10 15:55:07 +00:00
Amine Khaldi
eb3a7eb1a4 [PSDK]
- Deduplicate/improve architecture related definitions.

svn path=/trunk/; revision=47736
2010-06-10 15:35:16 +00:00
Cameron Gutman
ec000c8544 [DHCPCSVC]
- Implement adapter discovery after startup (currently does not work because the iphlpapi code is not implemented)

svn path=/trunk/; revision=47732
2010-06-10 04:38:04 +00:00
Jérôme Gardou
937d830410 [ROSTESTS]
test what happens when a DC is saved and a bitmap is selected into it.

svn path=/trunk/; revision=47730
2010-06-10 00:17:06 +00:00
Cameron Gutman
8be9465a83 [ACPI]
- Create a resource list for the PCI root bus (even though it doesn't use any resources according to ACPI) and fill it with a bus number resource descriptor
- Fixes PCI device detection with ACPI enabled

svn path=/trunk/; revision=47729
2010-06-09 23:02:34 +00:00
Amine Khaldi
2d489373f9 - Fix localspl and localui build.
svn path=/trunk/; revision=47728
2010-06-09 22:28:14 +00:00
Amine Khaldi
b02092777f Reintegrate header-work branch. Important changes include continued work on headers and progress on compiling for ARM.
svn path=/trunk/; revision=47727
2010-06-09 22:24:32 +00:00
Cameron Gutman
594306cee5 [ACPI]
- Store the interrupt data as the vector and level
- Fixes resource conflict issues

svn path=/trunk/; revision=47726
2010-06-09 22:15:17 +00:00
Cameron Gutman
16f616a8de [NTOSKRNL]
- Set the resource list pointer to NULL after we free it
- Fixes a double-free issue in the resource conflict resolution code

svn path=/trunk/; revision=47725
2010-06-09 21:53:42 +00:00
Cameron Gutman
186dc06a99 [PCI]
- Implement IRP_MN_REMOVE_DEVICE handling for FDOs

svn path=/trunk/; revision=47723
2010-06-09 20:12:27 +00:00
Cameron Gutman
8ebc45f80b [NTOSKRNL]
- Implement IRP_MN_REMOVE_DEVICE handling for PnP root PDOs

svn path=/trunk/; revision=47722
2010-06-09 20:04:39 +00:00
Amine Khaldi
9767b4ca2c Sync uo to HEAD (r47720).
svn path=/branches/header-work/; revision=47721
2010-06-09 18:58:14 +00:00
Amine Khaldi
fab6b4c37c - Add some header guards.
svn path=/branches/header-work/; revision=47720
2010-06-09 18:30:37 +00:00
Amine Khaldi
8338472430 - Temporarily move those headers from PSDK to DDK (due to svn awesomeness).
svn path=/branches/header-work/; revision=47718
2010-06-09 17:33:59 +00:00
Amine Khaldi
0e546b8516 - Update ReactOS-amd64.rbuild
svn path=/branches/header-work/; revision=47717
2010-06-09 17:22:54 +00:00
Amine Khaldi
a8cc636ac7 [DDK]
- Replace dciddi.h with the one from mingw-w64
[PSDK]
- Get rid of duplicate dciddi.h

svn path=/branches/header-work/; revision=47716
2010-06-09 17:19:06 +00:00
Johannes Anderwald
a7e58af961 [MMIXER]
- Handle failure of device enumeration
- Add sanity check

svn path=/trunk/; revision=47715
2010-06-09 16:51:16 +00:00
Johannes Anderwald
1bb04a5142 [KS]
- Perform all allocations / frees in dedicated alloc / free function

svn path=/trunk/; revision=47714
2010-06-09 14:44:46 +00:00
Johannes Anderwald
db5472b519 [KS]
- Fix memory leak

svn path=/trunk/; revision=47713
2010-06-09 14:16:05 +00:00
Ged Murphy
85b59ff6ce I don't like this, but add the treeview refresh hack.
I don't see this bug on my (windows) build but others are reporting it still happens on the (linux) build machine iso.
Maybe it's because linux is akin to the devil? Yes, I like this, let's blame linux!

svn path=/trunk/; revision=47712
2010-06-09 13:31:02 +00:00
Johannes Anderwald
a1979b8e2d [PORTCLS]
- Check if resource list has been allocated

svn path=/trunk/; revision=47711
2010-06-09 13:27:19 +00:00
Amine Khaldi
513fbfa56f - Leftover from the sync.
svn path=/branches/header-work/; revision=47710
2010-06-09 12:07:22 +00:00
Aleksey Bragin
a24aedc9d1 - Add "bootcdregtest" in the list of well-known targets.
svn path=/trunk/; revision=47708
2010-06-09 10:34:35 +00:00
Ged Murphy
6df5db960f This bug seems to have gone now. Tried to replicate it the devmgmt treeview.
svn path=/trunk/; revision=47706
2010-06-09 08:09:35 +00:00
Ged Murphy
b589f99b78 Merge second part of the comctl32 Wine 1.2 sync.
All code currently omits the reactos specific patches. It's been a long time since we synched this lib so it's possible we no longer need them. Time will tell.

svn path=/trunk/; revision=47705
2010-06-09 08:04:35 +00:00
Cameron Gutman
4829efbb66 [IP]
- Handle socket operations that can be completed immediately before terminating the socket to avoid losing data sitting in the receive buffer

svn path=/trunk/; revision=47704
2010-06-09 04:45:17 +00:00
Timo Kreuzer
14725d6e20 Sync trunk (r47699)
svn path=/branches/header-work/; revision=47700
2010-06-08 22:20:26 +00:00
Sylvain Petreolle
82cd2aad07 Merge RtlIpv4StringToAddressW fix from network branch.
svn path=/trunk/; revision=47699
2010-06-08 20:24:15 +00:00
Amine Khaldi
e47de493b4 Sync trunk head (r47697).
svn path=/branches/header-work/; revision=47698
2010-06-08 20:04:37 +00:00
Timo Kreuzer
74e0c79a8d [PSDK]
Merge 47681 and 47682 from header branch
- Add missing file headers
- Fix defintition of POINTER_64
- by Amine Khaldi

svn path=/trunk/; revision=47697
2010-06-08 14:31:31 +00:00
Ged Murphy
883961ce2c Move UTF8 to the bottom of the file. Thanks to Christoph for the tip
svn path=/trunk/; revision=47696
2010-06-08 11:09:32 +00:00
Ged Murphy
94fa5d4e23 Part 1 of the comctl32 sync. I'll do it in 2 stages for testing purposes as it's a very large patch.
This part includes alpha support for imagelists and tango icons for the common toolbars
I'll do the second part later today. It has a propsheet bug and I'm a bit busy at the mo.

svn path=/trunk/; revision=47695
2010-06-08 10:21:26 +00:00
Ged Murphy
e5239a070c Add missing info needed for the comctl32 sync
svn path=/trunk/; revision=47694
2010-06-08 10:16:34 +00:00
Jeffrey Morlan
9f7057e9f2 [KERNEL32], [WIN32CSR]
- Implement ReadConsoleW's CONSOLE_READCONSOLE_CONTROL structure.
- Make pressing Insert during line input work

svn path=/trunk/; revision=47693
2010-06-08 06:38:14 +00:00
Timo Kreuzer
4625d1efa0 revert 47688 and 47689
svn path=/trunk/; revision=47691
2010-06-08 01:37:58 +00:00
Timo Kreuzer
de7cdd5617 [BOOTCD]
Add cabman to bootcd. This is for diagnostic purposes.

svn path=/trunk/; revision=47689
2010-06-08 00:19:34 +00:00
Timo Kreuzer
9b4daa14f8 [ZLIB]
Revert r47411. This is a test to see if it fixes the sysreg crash in 1st stage.

svn path=/trunk/; revision=47688
2010-06-07 23:39:37 +00:00
Johannes Anderwald
65169e1f54 [WDMAUD_KERNEL]
- Extend the mdl hack

svn path=/trunk/; revision=47687
2010-06-07 23:00:04 +00:00
Sylvain Petreolle
5b8ed5479f Revert 47685.
svn path=/trunk/; revision=47686
2010-06-07 21:38:49 +00:00
Sylvain Petreolle
03b31fbc3f Enable debug in usetup. This will be reverted in next commit.
svn path=/trunk/; revision=47685
2010-06-07 21:36:37 +00:00
Sir Richard
90d92560f4 [HAL]: Use Bus Handler support for HalFindBusAddressTranslation. Implement HalpContextToBusHandler to support this. Seems to work fine with bootvid (only user).
All the HAL's bus functions now use Bus Handlers on Legacy systems. There are still big issues with PCI cards.
       eVb: PCI-x should work now.
       More PCI-related HAL patches may follow later.

svn path=/trunk/; revision=47684
2010-06-07 21:36:31 +00:00
Sir Richard
a37a4a9e07 [HAL]: Use Bus Handlers for HalpAssignSlotResources. Warn that current PCI Slot assignment code is frelled.
[HAL]: Add PAGED_CODE();
[HAL]: Fix HALACPI build break.

svn path=/trunk/; revision=47683
2010-06-07 21:26:09 +00:00
Amine Khaldi
9ca3ec1085 [PSDK]
- Update/improve some usb related headers' headers.

svn path=/branches/header-work/; revision=47682
2010-06-07 21:19:24 +00:00
Amine Khaldi
f19e851716 [PSDK]
- Fix a "FIXME! HACK!!!"

svn path=/branches/header-work/; revision=47681
2010-06-07 21:15:05 +00:00
Sir Richard
1491820d8d [HAL]: Implement HalAdjustResourceList using Bus Handler support. Previous HAL said this was "deprecated" and faked success. Although correct on ACPI HALs, this is a legacy HALs, so Bus Handlers have a chance to do ajdustment.
svn path=/trunk/; revision=47680
2010-06-07 21:06:16 +00:00
Sir Richard
28bde112e1 [HAL]: Implement HalTranslateBusAddress using Bus Handler support. The old HAL would just return whatever the caller gave (no translation was done). For example, with the new HAL, this now results in the translation of 0xCF800 in I/O space to fail (not sure which driver requests this), because this is not a valid I/O address on PC/AT systems (highest is 0xFFFF).
This change also allows for the PCI driver to override the translation mechanism (which will piggy-back to the system bus translator) with its own. Please test.

svn path=/trunk/; revision=47679
2010-06-07 21:01:53 +00:00
Sir Richard
0ae7a75158 [HAL]: Implement ISA BUS address translation.
svn path=/trunk/; revision=47678
2010-06-07 20:59:46 +00:00
Sir Richard
fc0a9b1bef [HAL]: Implement system bus address translation.
svn path=/trunk/; revision=47677
2010-06-07 20:59:00 +00:00
Sir Richard
7ebba8b83c [HAL]: Implement Bus Handler support for HalGetInterruptVector too. The new functionality now includes support for checking against reserved HAL vectors instead of blindling assining IRQLs/Vectors to callers. A warning is printed on the debug log when the old HAL would've returned different values. Please test. If you have issues, the problem is in the DRIVERS, not this code.
svn path=/trunk/; revision=47676
2010-06-07 20:39:11 +00:00
Sir Richard
566408b2d9 [HAL]: Implement PCI Vector/IRQL translation too.
svn path=/trunk/; revision=47675
2010-06-07 20:37:45 +00:00
Sir Richard
6bbba6481b [HALMP]: MP HAL should have HalpDefaultInterruptAffinity too.
svn path=/trunk/; revision=47674
2010-06-07 20:37:19 +00:00
Sir Richard
edda414937 [HAL]: Forgot file.
svn path=/trunk/; revision=47673
2010-06-07 20:35:02 +00:00
Sir Richard
1b1d03c8a0 [HAL]: Implement system bus (and ISA) vector/interrupt translation.
svn path=/trunk/; revision=47672
2010-06-07 20:34:41 +00:00
Sir Richard
dcde6d79da [HAL]: Use Bus Handler support for HalSetBusDataByOffset. Please report any problems.
svn path=/trunk/; revision=47671
2010-06-07 20:13:05 +00:00
Sir Richard
cc500cbf5c [HAL]: First use of bus handler support: HalGetBusDataByOffset now uses bus handlers. Please report any problems.
svn path=/trunk/; revision=47670
2010-06-07 20:10:53 +00:00
Sir Richard
e8040d911e [HAL]: I don't like to swear, but F*CK this MiniHAL bullsh*t!
svn path=/trunk/; revision=47668
2010-06-07 18:30:20 +00:00
Amine Khaldi
4edc0517fc Sync up to trunk head (r47666)
svn path=/branches/header-work/; revision=47667
2010-06-07 17:15:29 +00:00
Sir Richard
c2677cf238 [HAL]: Plug in the data from pcidata.c that was committed months ago to display a beautiful enumeration of all PCI devices on the machine. This will allow debug logs not only to contain nearly full hardware information, but also identify the VM the tester/reporter is using (based on the device's subsystem ID).
[HAL]: Display all the warning DPRINTs in-line with the PCI enumeration code, resulting in a much easier to read and comprehensive review of the machine.

svn path=/trunk/; revision=47666
2010-06-07 17:01:56 +00:00
Sir Richard
bf8a146243 [HAL]: Implement HalpGetPciBridgeConfig to detect PCI-to-PCI/CardBus bridges, warn if they are found.
[HAL]: Modify the debug messages to be more accurate as to what exactly is unsupported.

svn path=/trunk/; revision=47665
2010-06-07 16:44:12 +00:00
Sir Richard
f098f2ae2b [HAL]: Implement partly HalpFixupPciSupportedRanges to detect PCI Bridges, and PCI-to-PCI Bridges. The point is we want buses to be cramped down to the addresses supported by the parent bus/bridge. This is NOT currently done, so we warn users of these systems.
svn path=/trunk/; revision=47664
2010-06-07 16:15:01 +00:00
Sir Richard
9ef2a02386 [HAL]: Detect, check for, and warn about, chipset hacks that need to be applied for the machine.
svn path=/trunk/; revision=47662
2010-06-07 15:34:35 +00:00
Amine Khaldi
6bc4e97d08 Sync trunk.
svn path=/branches/header-work/; revision=47661
2010-06-07 15:30:17 +00:00
Sir Richard
2031c565df [NTOS]: Check registry for our CardList, check if the PCI hardware matches any entry in there that specifies it has full/extended address decoding, and write the registry flag for it.
svn path=/trunk/; revision=47660
2010-06-07 15:09:44 +00:00
Sir Richard
83c3c7abb2 [HAL]: Detect IDE controllers. Their interrupts should not be masked.
svn path=/trunk/; revision=47659
2010-06-07 15:02:49 +00:00
Michael Martin
7c5fd856ee [win32k]
- Change the number of windowless timers from 1024 to 32768.
- When destroying windowless timers, clear the bit number (IDEvent) in the bitmap so the bit number can be reused.
- Only create a windowless timer if there is no windowless timer matching IDEvent.
- Fixes case where applications create too many windowless timers and/or run out of windowless timers.

svn path=/trunk/; revision=47658
2010-06-07 13:37:43 +00:00
Cameron Gutman
b2c96e402d [MSAFD]
- Fix a bug in GetSocketStructure that resulted in us missing the last entry of the list
- Remove an "optimization" which was supposed to find an unused socket entry (which it almost never did) but now just corrupts the linked list by trashing our NextSocket pointer

svn path=/trunk/; revision=47656
2010-06-07 05:40:08 +00:00
Sir Richard
adc324f5c9 [HAL]: Detect, initialize, and create bus handlers for, all PCI buses that are found on the machine.
[HAL]: Detect PCI-to-PCI Bridges, Extended CardBus Addressing, read Chipset Hacks from Registry, and scan for IRQ lines used by PCI Devices. Scan for PCI-IDE controllers, broken Intel PCI Bridges/Controllers. Scan for OHCI and UHCI USB controllers. Warn the user that if any of these are found, the current HAL does not handle certain types of these devices (these checks are based on the ones the Legacy Windows HAL makes).

svn path=/trunk/; revision=47655
2010-06-07 03:23:48 +00:00
Sir Richard
07b14e926d [HAL]: Add missing PCI Bus Handler support functions, used on non-ACPI systems (ISA-PCI support and such).
svn path=/trunk/; revision=47654
2010-06-07 03:19:20 +00:00
Sir Richard
e2d5c9d92b [HAL]: Kill debug spew.
svn path=/trunk/; revision=47653
2010-06-07 03:18:51 +00:00
Cameron Gutman
e91cc9349b [MSAFD]
- Fix 2 more callers who don't pass a valid lpErrno pointer
- Check the return value of WSPSocket
- Return WSAEWOULDBLOCK if there are no connections that can be accepted instead of silently returning 0 which is not INVALID_SOCKET so the caller treats it as a valid socket pointer and passes it to other functions which caused wide-spread mayhem since we never checked whether the socket handle the caller passed was valid until my last commit

svn path=/trunk/; revision=47652
2010-06-07 01:50:26 +00:00
Cameron Gutman
d19620d1ab [AFD]
- It is legal to send a NULL event object pointer to AFD (this is sent by msafd to cancel an existing event select)

svn path=/trunk/; revision=47651
2010-06-07 01:38:15 +00:00
Cameron Gutman
88c29ff4f2 [MSAFD]
- Validate that we found the corresponding socket information in our socket information list
- Fixes a crash in Firefox 2 when it tries to call accept() with a closed socket

svn path=/trunk/; revision=47650
2010-06-07 01:24:15 +00:00
Sir Richard
ad1721c016 [HAL]: Bus support in the HAL actually creates a further wedge between the different x86 HALs: There are actually two dinstinct implementations. On the ACPI HAL, the system is assumed not to have things like special ISA, MCA, EISA buses, and a PCI driver is used in combination with the ACPI Interface for PCI Bus support. On non-ACPI systems, the legacy "Bus Handler" library is used, and the HAL provides a core set of CMOS, EISA, ISA, MCA and PCI bus handlers, each with their own routines and specific code. Additionally, PCI IRQ Routing and other PCI bus internals are handled directly by the HAL -- on the ACPI HAL, the PCI Bus support is implemented through a "Fake"/static bus handler, just to keep the functions shared. On ReactOS, both the ACPI and non-ACPI HAL were currently using a mix of both HAL bus handling types, mostly implemented the "ACPI way" (with a fake PCI bus handler and such).
As a result, none of the Hal*Bus HALDISPATCH routines were implemented, which bus drivers expect to find when they're not on ACPI systems (ReactOS today). eVb's new PCI driver was crashing, for example.
       Furthermore, legacy systems suffer, because the ACPI HAL Bus routines (that we currently have) expect perfect ACPI-style-compliant systems, not the legacy crap from the early 90ies. This works fine in VMs and new hardware, but old hardware is left behind.
       This patch basically corrects the first part of the problem, by making the bus handling support separate between ACPI and non-ACPI HALs. For now, the code remains 100% the same in functionality between both.
       However, I have started adding the first few elements:
[HAL]: Implement HalRegisterBusHandler HALDISPATCH routine.
[HAL]: On legacy HALs, register the CMOS, ISA, SYSTEM handlers.
[HAL]: Add cmosbus.c. Stub all bus-specific bus handler routines in the xxxbus.c files.
No real functionality change occurs with this patch, yet.

svn path=/trunk/; revision=47649
2010-06-07 01:09:41 +00:00
Sir Richard
af870b6e47 [DHCP/FTP]: Fix building on OS X hosts.
svn path=/trunk/; revision=47648
2010-06-07 00:58:55 +00:00
Cameron Gutman
9cf2124763 I hate making the same mistake twice in one day
svn path=/trunk/; revision=47647
2010-06-07 00:44:00 +00:00
Cameron Gutman
e0549f6100 [MSAFD]
- Use a linked list to store the socket information instead of allocating a massive array (1024 elements!) for each process in DllMain to hold all of the pointers
- Fix a massive memory leak (free the socket information which we leaked for every socket we allocated)
- This improves performance because we don't have to look through an array of stale socket information pointers (which we never actually removed from the socket information array in the old code) and the new code queues the socket information at the head of the list which makes newer sockets faster to access

svn path=/trunk/; revision=47646
2010-06-07 00:24:27 +00:00
Cameron Gutman
0b3f90dce4 Remove an unintended change
svn path=/trunk/; revision=47645
2010-06-06 23:49:27 +00:00
Daniel Reimer
8404cbb540 Add Opera 9 to rapps.
Update OOo to 3.2.1 and the last time... fix the FF2 link.

svn path=/trunk/; revision=47644
2010-06-06 23:45:20 +00:00
Cameron Gutman
fbc1db9487 [MSAFD]
- Fix many times where we wait for an operation but don't update our status and return if it failed
- Fix the overlapped pending case in writing which was completely broken (callers would detect an error but GetLastError would return 0 because we didn't store the error in the lpErrno variable)
- Fix many times where we pass a pointer to an event that we close without waiting
- Fix a bug in WSPEnumNetworkEvents when we would set WSAEINVAL in the lpErrno variable but not return SOCKET_ERROR so the error got ignored

svn path=/trunk/; revision=47643
2010-06-06 23:07:26 +00:00
Cameron Gutman
444eec4511 [NDIS]
- Hold the miniport lock when we work with the timer queue
- Use the return value of KeSetTimer(Ex) to determine whether we need to queue the timer in our queue, otherwise we just use the entry that is already there
- Add more assertions

svn path=/trunk/; revision=47642
2010-06-06 22:08:40 +00:00
Cameron Gutman
6e1d1db7af Forgot to remove this ASSERT for r47636
svn path=/trunk/; revision=47639
2010-06-06 21:31:58 +00:00
Gregor Schneider
928accdc2c [WIN32K]
- Use TAG_KEYBOARD for keyboard layouts
- Free TAG_ACCEL and TAG_DRIVER allocations with their tags

svn path=/trunk/; revision=47637
2010-06-06 19:29:20 +00:00
Cameron Gutman
c01132e4ff [NDIS]
- Only dequeue the timer in the DPC if the Period is 0 (which means that it's NOT a periodic timer so we only get called once)
- Attempt to dequeue the timer before inserting it so we don't end up with multiple copies of the same timer on the timer queue if somebody calls NdisMSet(Periodic)Timer twice

svn path=/trunk/; revision=47636
2010-06-06 19:18:19 +00:00
Gregor Schneider
a4aeb090df [WIN32K]
- Use TAG_PALETTE for palette entries
- Remove mapping codes, the functions from pre r9000 don't even exist anymore

svn path=/trunk/; revision=47635
2010-06-06 19:11:52 +00:00
Gregor Schneider
218cfae51d [WIN32K] Use TAG_GDIICM tag for ICM allocations
svn path=/trunk/; revision=47634
2010-06-06 18:51:43 +00:00
Stefan Ginsberg
622c4a0919 [NTOS] Inline writing to PTEs through MI_WRITE_VALID/INVALID_PTE.
svn path=/trunk/; revision=47633
2010-06-06 18:45:46 +00:00
Gregor Schneider
d607e811d9 [WIN32K] Free allocations with the tag that was used to allocate them
svn path=/trunk/; revision=47632
2010-06-06 18:34:57 +00:00
Gregor Schneider
dd3d52b5ed [WIN32K] assert -> ASSERT
svn path=/trunk/; revision=47631
2010-06-06 18:32:57 +00:00
Cameron Gutman
f44eee190b [NDIS]
- Implement miniport timer queuing
- Add some BUGCODE_ID_DRIVER bug check cases for missing interrupt deregistration, missing timer cancellation, and invalid IRQL when calling NdisMAllocateSharedMemory

svn path=/trunk/; revision=47630
2010-06-06 18:09:25 +00:00
Sylvain Petreolle
6dd30b1f3a Forgotten in previous commit.
svn path=/branches/aicom-network-branch/; revision=47629
2010-06-06 16:46:25 +00:00
Sylvain Petreolle
bb72205f9f Fix RtlIpv4StringToAddressW prototype and its caller in ws2_32.
Fixes crash in GetAddrInfoW on xp sp3.

svn path=/branches/aicom-network-branch/; revision=47628
2010-06-06 16:33:17 +00:00
Sir Richard
d7372c2dc4 [NTOS]: Enable usage of ARM3 paged pool, up until Mm Phase 2.
[NTOS]: Re-arrange some of the init code, now that we have access to ARM3 paged pool early-on. Move more code to ARM3::INIT in its right place.
[NTOS]: Enable using the ARM3 PFN Database, getting rid of the old ReactOS PFN database. Should reduce physical memory usage now that we don't have two copies anymore.
[NTOS]: Fix the ARM3 PFN Datbase initialization code.
[NTOS]: Get rid of MiInitializePageList, use MiGetPfnEntryOffset instead of hard-coded pointer math in freelist.c.
This is the last big low-level Mm/ARM3 patch for a long, long time.

svn path=/trunk/; revision=47627
2010-06-06 15:59:42 +00:00
Sir Richard
55e7a4b5bf [COMPBATT]: Remove useless function.
svn path=/trunk/; revision=47626
2010-06-06 15:49:54 +00:00
Stefan Ginsberg
8e367dfc1b - Fix a comment and remove a superfluous extern.
svn path=/trunk/; revision=47625
2010-06-06 14:42:03 +00:00
Sir Richard
5867b89ee6 [NTOS]: Another one bites the dust, another one bites the dust. And another one gone and another one gone. Another one bites the dust, yeah. Out of the doorway the bullets rip, Repeating to the sound of the beat.
svn path=/trunk/; revision=47624
2010-06-06 14:24:18 +00:00
Sir Richard
aa574a3c90 [NTOS]: A PFN entry is not necessarily physical only if it is higher than MmHighestPhysicalPage. It can also be physical if it lies in a memory hole within the min-max physical page range. We can detect this by using our PFN Bitmap. So replace all "Is this an I/O mapping?" checks with a check on whether or not the PFN Database entry is NULL (which will check for us both of these statements). This ought to be a macro...
svn path=/trunk/; revision=47623
2010-06-06 14:15:18 +00:00
Sir Richard
abefb827e7 [NTOS]: Don't use MmAllocPage for the first paged pool PDE, instead, use MiRemoveZeroPage.
[NTOS]: Use MiInitializePfnForOtherProcess to setup the first paged pool PDE.

svn path=/trunk/; revision=47622
2010-06-06 14:13:35 +00:00
Sir Richard
49448736a2 [NTOS]: Implement MiRemoveZeroPage and MiZeroPhysicalPage.
Not yet used.

svn path=/trunk/; revision=47621
2010-06-06 14:12:28 +00:00
Sir Richard
08b2876a25 [NTOS]: Fix a loop off-by-one when saving the page table index in contigious memory allocation PFNs. Spotted by Stefan100.
svn path=/trunk/; revision=47620
2010-06-06 13:42:19 +00:00
Timo Kreuzer
ebd10beb1f Add /KDSERIAL to the command line, to make sysreg able to bt in first stage.
svn path=/trunk/; revision=47615
2010-06-06 07:52:32 +00:00
Timo Kreuzer
f301a8c2d3 [NTOSKNRL]
Add the possibility to break on all first chance exceptions, by passing /FIRSTCHANCE on the command line. Enable it temporary to get some more information from the sysreg crash.

svn path=/trunk/; revision=47614
2010-06-06 07:35:21 +00:00
Michael Martin
5e130771e7 [rtl]
- Fix a overlooked change needed due to mbstowcs fix. Use the number of WCHARs vice number of bytes to calculate end of xmlbuf. 


svn path=/trunk/; revision=47613
2010-06-06 07:21:53 +00:00
Sir Richard
854ff3471b [NTOS]: Clean up /mm a bit, move sysldr.c into ARM3.
svn path=/trunk/; revision=47608
2010-06-06 04:38:51 +00:00
Sir Richard
01194e41b9 [NTOS]: Silence more debug spew.
svn path=/trunk/; revision=47607
2010-06-06 04:37:53 +00:00
Sir Richard
143221853b [NTOS]: Fix for the the bug that broke ARM3 paged pool (and has been corrupting ReactOS paged pool behind the scenes for years):
When a KCB (key stuff) is allocated, the key name associated with it receives an NCB (name stuff). In case this name is already used, a cache exists, and an existing NCB is grabbed, and its reference count is increased. When the KCB goes away, its NCB loses a reference. When all references are gone, the NCB is destroyed. Simple enough.
        It turns out that what was currently happening is that an NCB would get dereferenced to 0, deleted, but still remained attached to a valid KCB (shouldn't happen). When that KCB went away, the NCB's reference count was dropped to... -1, and then -2, -3, -4, etc. Remember this is a FREED NCB. In other words, freed pool, that might now belong to someone else, was getting "-1" operations on it. So any value stored in that freed pool would get decremented by one. In ARM3 paged pool, because the allocator keeps a linked list, what would happen is that the FLINK pointer would be 0xE0F01234 instead of 0xE1A01234. What happened is that "0xE1A0" was treated as the reference count of the freed NCB, and it kept getting dereferenced down to 0xE0F0.
        Proving this was easy, by adding an ASSERT(Ncb->RefCount >= 1) to the routine that dereferences NCBs. Obviously, we should not try to dereference an NCB that has a reference count of 0, because that NCB is now gone. Adding this ASSERT immediately caught the error, regardless of which pool implementation was being used, so this was a problem in ReactOS today, right now.
        My first thought was that we were taking references to NCBs without incrementing the reference count. The NCB gets referenced in two places: when it gets created, and everytime a cached NCB is re-used for a new KCB (all this in CmpGetNameControlBlock).
	After adding some tracing code, I discovered that CmpGetNameControlBlock would sometimes return an NCB that was cached, but without referencing it. I did not understand why, since the code says "if (Found) Ncb->RefCount++".
        Further analysis showed that what would happen, on this particular instance, is that NCB "Foo" was being Found, but NCB "Bar" was returned instead. Therefore, causing some serious issues: First, NCB Foo was receiving too many references. Secondly, NCB Bar was not being referenced.
        Worse though, it turns out this would happen when "Foo" was the CORRECT NCB, and "Bar" was an INCORRECT NCB. What do we mean by correct and incorrect? Well, because NCBs are hashed, it's possible for two NCB hashes to be VERY SIMILAR, but only ONE OF THOSE NCBs will be the right one -- for example, HKLM\Software\Hello vs HKLM\Software\Hell.
        In our case, when a KCB for "Hello" was searching for the "Hello" NCB, the "Hello NCB would get a reference, but the "Hell" NCB would be returned. In other words, whenever a HASH COLLISION happened, the incorrect NCB was returned, probably messing up registry code in the process. Subsequently, when the KCB was dereferneced, it was attached to this incorrect, under-referenced NCB.
        Since in ANY hash collision with "Hell", in our example, the "Hell" NCB would come first, subsequent searches for "Hellmaster", "Hellboy", "Hello World" would all still return "Hell". Eventually when all these KCBs would go away, the "Hell" NCB would reach even -18 references.
        The simple solution? When the CORRECT NCB is found, STOP SEARCHING! By adding a simple "break" statement. Otherwise, even after the correct NCB is found, further, incorrect, collided NCBs are found, and eventually the last one ("Hell", in our example) got returned, and under-referenced, while "Hellmaster" and "Hellboy" were not returned, but LEAKED REFERENCES.
        There you have it folks, MEMORY CORRUPTION (USE-AFTER-FREE), INCORRECT REGISTRY NAME PARSHING, REFERENCE LEAKS and REFERENCE UNDERRUNS, all due to ONE missing "break;".
        -r

svn path=/trunk/; revision=47605
2010-06-06 01:04:03 +00:00
Sir Richard
570567b87e [NTOS]: Kill some debug spew.
svn path=/trunk/; revision=47604
2010-06-06 00:49:26 +00:00
Sir Richard
c28fc63bf4 [NTOS]: Even after allowing ARM3 paged pool, we should still use the old allocator to free allocations made by the old allocator!
svn path=/trunk/; revision=47601
2010-06-05 19:32:46 +00:00
Sir Richard
5f1255ce5b [NTOS]: Fix up POOL_PREV_BLOCK based on suggestion by hpoussin.
[NTOS]: Fix up NTAPI location in function definition.
[NTOS]: Implement even more stringent header checks: ExpCheckPoolHeader and ExpCheckPoolBlocks. Normally we would only want this on a DBG build, but I am enabling them for now until I can fix paged pool. If your machine crashes, reverting this commit is NOT the solution (boots for me).
[NTOS]: Add a AllowPagedPool BOOLEAN that will allow us to selectively enable when the ARM3 pool can be used, playing around with the situation that causes the corruption, and perhaps making it easier to find/fix.

svn path=/trunk/; revision=47600
2010-06-05 19:19:28 +00:00
Sir Richard
ed9f4ad2de [NTOS]: Kill debug spew.
svn path=/trunk/; revision=47599
2010-06-05 19:17:21 +00:00
Sir Richard
5d77839f4f [NTOS]: Fix Exp*PoolList macros. Also make then non-inlined, so we can see who called them in a stack trace.
[NTOS]: Enable them.
This boots on my system -- if it doesn't boot on yours, someone is corrupting your nonpaged pool. Reverting this patch is NOT the solution to your woes.

svn path=/trunk/; revision=47598
2010-06-05 18:26:15 +00:00
Jeffrey Morlan
ffce25e515 [WIN32CSR]
- Implement basic support for history in line editing
- Reorganize code to reflect that line input is more coupled to history than it is to character input

svn path=/trunk/; revision=47597
2010-06-05 18:17:42 +00:00
Sir Richard
745031cf0b [NTOS]: Add some paranoid-invariant list access checks to the pool code. They serve a dual purpose: catch pool corruption by broken drivers/kernel code, as well as catch malicious modification of the pool links as part of a kernel-mode exploit.
[NTOS]: Not yet used, thanks to Arthur for the idea.
See comment for more information.

svn path=/trunk/; revision=47596
2010-06-05 18:02:45 +00:00
Sir Richard
81589f83ca [NTOS]: Defensive programming on the pool macros.
svn path=/trunk/; revision=47595
2010-06-05 17:54:19 +00:00
Sir Richard
fc1ffb8a44 [NTOS]: Use logical math operations on the various block<->entry<->free_list_head operations in the pool code, instead of works-by-chance-and-assumption pointer math operations. This will now allow pool implementations where the pool header is not the size of a pool block (and the size of a LIST_ENTRY, by definition, although, even that, could change, if we choose to implement a cache-aligned overhead).
svn path=/trunk/; revision=47594
2010-06-05 17:53:17 +00:00
Cameron Gutman
e8b356d800 [NTOSKRNL]
- Print the base address of the process that we killed to make debugging much easier

svn path=/trunk/; revision=47593
2010-06-05 17:51:12 +00:00
Sir Richard
cb9c4019bb [NTOS]: Define the POOL_HEADER for x64.
[NTOS]: Define POOL_BLOCK_SIZE definition to set the minimum pool block size. In NT, this is equal to a LIST_ENTRY structure, because the Pool Allocator must be able to store a LIST_ENTRY into a freed pool block. This also determines the alignment of pool allocations. So 8 on x86, 16 on x64.
[NTOS]: Don't depend on LIST_ENTRY, but use POOL_BLOCK_SIZE instead (on IA64, if we ever want to support this, the pool block size is different from a LIST_ENTRY/POOL_HEADER).
[NTOS]: The following ASSERTs must hold: the POOL_HEADER must be as big as the the smallest pool block (POOL_BLOCK_SIZE), which must be at least as big as a LIST_ENTRY structure. 8 == 8 == 8 on x86, 16 == 16 == 16 on x64.

svn path=/trunk/; revision=47592
2010-06-05 16:53:54 +00:00
Sir Richard
6aad48190c [NTOS]: Don't assume that ANY fault in the system address range, not associated to a memory area, might be ARM3. Instead, since this hack only exists for early boot page pool support, make only treat this as an ARM3 fault when it happens in the paged pool area or higher. Leads to more direct Mm crashes when invalid page access happens, instead of infinite "PAGE FAULT ON PAGE TABLES".
svn path=/trunk/; revision=47589
2010-06-05 14:59:50 +00:00
Sir Richard
549eedeeb4 [NTOS]: In MiInitializePfnForOtherProcess, should increment the sharecount of the page table PFN entry, not the PFN entry of the PTE itself. Spotted by Stefan100.
svn path=/trunk/; revision=47588
2010-06-05 14:55:17 +00:00
Sir Richard
a2a190f44b [NTOS]: In MiDeleteSystemPageableVm, should also handle the case where the PTE is demand-zero. This can happen if the caller allocated, say, 12KB (3 pages) of paged pool, only touched 4KB (1 page), and then frees the allocation -- the other 2 pages will still be demand-zero at this point.
svn path=/trunk/; revision=47587
2010-06-05 14:54:26 +00:00
Eric Kohl
89c8d4178c [NTOSKRNL]
NtDuplicateToken: Fail, if a primary token is to be created from an impersonation token and and the impersonation level of the impersonation token is below SecurityImpersonation.

svn path=/trunk/; revision=47586
2010-06-05 12:20:53 +00:00
Jeffrey Morlan
7da6d0a6e2 [WIN32CSR] Implement some basic line editing capability
svn path=/trunk/; revision=47584
2010-06-05 06:10:53 +00:00
Sir Richard
f4f8ee78d1 [NTOS]: Implement MiDeleteSystemPageableVm.
[NTOS]: The paged pool free code was behaving incorrectly, assuming that paged pool was "locked down" and never paged out/reused (a valid NT operation mode), while the allocation code was assuming paged pool was a volatile, reusable, pageable resource (normal NT operation mode). The free code now assumes normal operation mode, and actually frees the freed paged pool pages, by using MiDeleteSystemPageableVm.
I have a feeling this will make ARM3 paged pool work.

svn path=/trunk/; revision=47582
2010-06-05 04:16:46 +00:00
Jeffrey Morlan
9ef0181983 add missing file
svn path=/trunk/; revision=47581
2010-06-05 03:12:51 +00:00
Jeffrey Morlan
ffcb1445f7 [KERNEL32], [WIN32CSR]
- Implement console history (note: not too useful yet without any way to recall it)
- Implement APIs GetConsoleCommandHistoryLength, GetConsoleCommandHistory, ExpungeConsoleCommandHistory, SetConsoleNumberOfCommands, GetConsoleHistoryInfo, SetConsoleHistoryInfo.
- Remove stub of obsolete function SetConsoleCommandHistoryMode, which no longer exists in Windows.

svn path=/trunk/; revision=47580
2010-06-05 00:45:08 +00:00
Sir Richard
25bf23bfc1 [NTOS]: When expanding paged pool, use MiRemoveAnyPage, not MmAllocPage.
[NTOS]: When expanding paged pool, initialize the PFN entry for the allocated page. Note we might be in arbitrary process space, so the PTE is not necessary valid for the process causing the expansion.
[NTOS]: Implement MiInitializePfnForOtherProcess to handle the case above.
[NTOS]: Change two static ASSERTs into C_ASSERTs. Might break non-x86 builds for a bit (vs breaking them at boot, which is worse).
Paged pool should start working soon.

svn path=/trunk/; revision=47579
2010-06-04 22:08:40 +00:00
Timo Kreuzer
c25fc39e6f [winnt.h]
Fix definition of KNONVOLATILE_CONTEXT_POINTERS for amd64

svn path=/trunk/; revision=47578
2010-06-04 21:50:06 +00:00
Cameron Gutman
682cf08ee8 [FREELOADER]
- Use the old method for identifying the drive type (based on partition number) which actually works for floppies now because I changed the DrivePartition value returned (floppy = 0, cdrom = 0xFF) in a previous commit
- Fixes bug 5233

svn path=/trunk/; revision=47577
2010-06-04 20:36:48 +00:00
Cameron Gutman
fc022a8506 [FREELOADER]
- Remove duplicated code
- Add back the Mac hack but use 0x8A for the lowest CD-ROM drive number instead of 0x90

svn path=/trunk/; revision=47576
2010-06-04 20:22:29 +00:00
Sir Richard
63ce635b0f [NTOS]: Build paged pool demand-zero PTE with MI_MAKE_SOFTWARE_PTE macro.
[NTOS]: Handle paged pool demand-zero fault fulfillment with MI_MAKE_HARDWARE_PTE macro.
[NTOS]: Use MiRemoveAnyPage instead of MmAllocPage, in paged pool demand-zero fault fulfillment.
These changes affect code paths that are not currently in-use.

svn path=/trunk/; revision=47575
2010-06-04 20:18:27 +00:00
Timo Kreuzer
f150c299f2 [DDK]
Fix definition of USE_DMA_MACROS

svn path=/trunk/; revision=47574
2010-06-04 20:16:26 +00:00
Timo Kreuzer
ffc6aac247 [MMEBUDDY]
Make mmebuddy more 64bit compliant. Based on r40127 by Samuel Serapion with some modifications by me.

svn path=/trunk/; revision=47573
2010-06-04 18:37:14 +00:00
Jeffrey Morlan
6659ae1d98 [WIN32CSR] Console input simplification:
- Put code for processing events for line input in one place, instead of duplicating it everywhere
- Remove "Fake" and "NotChar" fields from ConsoleInput struct. ConioProcessKey didn't actually add Fake events; they were used for the \n when converting \r to \r\n, but this is better done by the line input code.
- Build an input line completely on the server side; this will make it practical to add history and more sophisticated editing later

svn path=/trunk/; revision=47572
2010-06-04 18:26:22 +00:00
Sir Richard
d3c4ade827 Testers: Please test this build.
[NTOS]: Implement a MI_MAKE_HARDWARE_PTE macro for the generation of valid kernel PTEs instead of always taking the ValidKernelPte and changing its flags. This macro will take into account the protection mask (up until now ignored) and use the array previously implemented to determine the correct hardware PTE settings. Assertions are also added to validate correct usage of the macro, and later revisions will fill out NT-specific fields to help deal with transition PTEs, page faults, etc.
[NTOS]: Make the stack code the first user of this macro, for the stack PTEs. Good testing base as we create kernel stacks very often.
[NTOS]: The NT MM ABI specifies that in between the allocation of a new PTE and its initialization as a valid PFN, the PTE entry should be an invalid PTE, and should only be marked valid after the PFN has been initialized. For stack PTEs, do this -- first allocating the page, making it invalid, then initializing the PFN, and then writing the valid page.

svn path=/trunk/; revision=47571
2010-06-04 17:49:36 +00:00
Sir Richard
1c28c16dfe [NTOS]: Allocate non-paged pool pages with MiRemoveAnyPage instead of MmAllocPage.
svn path=/trunk/; revision=47570
2010-06-04 17:40:11 +00:00
Timo Kreuzer
86ed4d64b5 [HAL]
Delete empty folder

svn path=/trunk/; revision=47569
2010-06-04 16:56:14 +00:00
Jeffrey Morlan
05740b5556 [WIN32CSR] Consistently store console input events internally as unicode.
svn path=/trunk/; revision=47568
2010-06-04 16:31:56 +00:00
Timo Kreuzer
3c5af5bea1 [KS]
- KSSTREAM_POINTER_OFFSET doesn't have an Alignment member on 64 bit systems. Comment the use out in these cases. It should probably be removed completely, as it's only an alignment / dummy value, but I leave this to the expert in this field.
- ULONG -> ULONG_PTR for pointer casts

svn path=/trunk/; revision=47567
2010-06-04 15:58:43 +00:00
Giannis Adamopoulos
eca252dba7 [win32k]
- CreateWindow: initialize window position after sending WM_GETMINMAXINFO message

svn path=/trunk/; revision=47566
2010-06-04 11:30:14 +00:00
Timo Kreuzer
2b0533a1b0 [HAL]
- Move all amd64 specific files to one amd64 folder
- Compile x86 specific timer code only on x86
- Use KeRegisterInterruptHandler instead of manual idt manipulation
- add missing stubs for amd64

svn path=/trunk/; revision=47565
2010-06-04 10:59:19 +00:00
Timo Kreuzer
a95f10c476 [NTOSKRNL]
Implement KeRegisterInterruptHandler and KeQueryInterruptHandler for amd64

svn path=/trunk/; revision=47564
2010-06-04 10:51:44 +00:00
Timo Kreuzer
32f5fc6eab [HAL]
- Move memory functions from halinit.c to new memory.c
- HalpAllocPhysicalMemory: MemoryFirmwareTemporary -> LoaderFirmwareTemporary (same value, different enum)

svn path=/trunk/; revision=47563
2010-06-04 10:17:55 +00:00
Jeffrey Morlan
0d06145871 [KERNEL32], [WIN32CSR]
- Make Get/SetConsoleTitle more compatible with windows; in particular, transfer title via capture buffer to allow for longer titles.
- Tighten up capture buffer validation in win32csr.

svn path=/trunk/; revision=47562
2010-06-04 06:36:12 +00:00
Timo Kreuzer
591e5017e9 revert 47559 and 47560 (once again... sigh)
svn path=/trunk/; revision=47561
2010-06-04 00:49:33 +00:00
Timo Kreuzer
38717f6840 try to fix build
svn path=/trunk/; revision=47560
2010-06-04 00:26:49 +00:00
Timo Kreuzer
babe335c71 [DDK]
Merge the rest of the old header-branch version of ntddk.h, but with a large number of additional types #if 0'ed out

svn path=/trunk/; revision=47559
2010-06-04 00:19:39 +00:00
Timo Kreuzer
a9cf165e5f [DDK]
try to work around the testbot brokenness with an #if 0"

svn path=/trunk/; revision=47558
2010-06-03 23:40:33 +00:00
Timo Kreuzer
a8d609e19d [HAL]
Include the correct headers for amd64 vs i386

svn path=/trunk/; revision=47557
2010-06-03 23:18:20 +00:00
Timo Kreuzer
9bbc1250d2 [DDK]
In an incredibly daring move, add even more types to ntddk.h

svn path=/trunk/; revision=47556
2010-06-03 23:08:40 +00:00
Timo Kreuzer
3cbb0a3c40 [DDK]
2nd try, this time adding half of the structures.

svn path=/trunk/; revision=47555
2010-06-03 22:25:25 +00:00
Timo Kreuzer
da7f98efe8 Revert r47553 because testbot doesn't like it
svn path=/trunk/; revision=47554
2010-06-03 22:15:54 +00:00
Timo Kreuzer
c3179d84ef [DDK}
Add a number of PCI related types to ntddk.h

svn path=/trunk/; revision=47553
2010-06-03 21:55:57 +00:00
Timo Kreuzer
9d059198bb [ReactOS-amd64.rbuild]
The old explorer won't compile for amd64 without massive hacking, so remove it from the build.

svn path=/trunk/; revision=47552
2010-06-03 20:57:25 +00:00
Timo Kreuzer
5cede710e0 [ROSTESTS]
Fix 64 bit build of some modules (Samuel Serapion, modified by me)

svn path=/trunk/; revision=47551
2010-06-03 20:08:26 +00:00
Timo Kreuzer
859c81ee74 [W32KNAPI]
Add few more tests for NtGdiCreateBitmap

svn path=/trunk/; revision=47550
2010-06-03 19:39:28 +00:00
Timo Kreuzer
4e381837a0 [GDI32API]
add IsHandleValid and use it SelectObject test

svn path=/trunk/; revision=47549
2010-06-03 19:35:05 +00:00
Gregor Schneider
10dc21e801 [DESK]
- Rearrange screensaver wait codes around the MsgWaitForMultipleObjects function
- Fixes screensaver configuration windows blocking the control panel
- Refs: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/375307.aspx and http://codereflect.com/2008/09/19/when-and-how-should-we-use-msgwaitformultipleobjects/

See issue #4213 for more details.

svn path=/trunk/; revision=47548
2010-06-03 18:47:37 +00:00
Timo Kreuzer
42667f14a0 [COMCTRL32]
Sync listview.c with wine 1.2 rc2


svn path=/trunk/; revision=47547
2010-06-03 17:56:15 +00:00
Timo Kreuzer
279fb08907 [PSDK]
add LVSIL_GROUPHEADER definition to commctrl.h

svn path=/trunk/; revision=47546
2010-06-03 17:52:23 +00:00
Timo Kreuzer
fbb71f36dc [BROWSEUI]
merge r44391 from amd64 branch
fix 64bit build


svn path=/trunk/; revision=47545
2010-06-03 17:44:52 +00:00
Giannis Adamopoulos
5ec9991072 [user32]
- Remove a reactos only export (PrivateCsrssInitialized)
- Don't call NtUserGetClassLong
- Move implementation of AnyPopup to user mode
- Fix a small bug in GetParent and in IsChild

[csrss]
- Don't call PrivateCsrssInitialized

[win32k]
- Call CsrInit in NtUserInitialize so we can remove PrivateCsrssInitialized
- Romove a reactos only syscall (NtUserGetClassLong)
- Remove UserGetClassLongPtr, UserGetWindow, UserGetWindowLong, IntGetOwner. Instead access objects directly
- In WINDOW_OBJECT store pointer to the ownder window instead of a handle

svn path=/trunk/; revision=47544
2010-06-03 16:12:43 +00:00
Timo Kreuzer
a101fb3029 [DDK]
Make RtlLargeIntegerDivide FORCEINLINE instead of __inline to avoid multiple definitions

svn path=/trunk/; revision=47543
2010-06-03 15:57:52 +00:00
Timo Kreuzer
33b6671aa1 [rbuild]
- cleanup obsolete rbuild flags for amd64
- undefine WIN32 for amd64, only _WIN32 should be defined

svn path=/trunk/; revision=47542
2010-06-03 15:50:19 +00:00
Gabriel Ilardi
54a043669e [SYSDM]
- Update Italian and Spanish translations.
- Add untranslated strings to the rest of the languages.

svn path=/trunk/; revision=47541
2010-06-03 15:09:08 +00:00
Timo Kreuzer
cce23ec5f3 [ACPICA]
- Hack acwin64.h, don't assume msvc for win64

svn path=/trunk/; revision=47540
2010-06-03 14:55:25 +00:00
Timo Kreuzer
997911a7be [RBUILD]
- append stdcall decoration only for i386 target

svn path=/trunk/; revision=47539
2010-06-03 14:49:47 +00:00
Timo Kreuzer
489842b382 merge 46805 from amd64 branch:
[RBUILD]
Fix some parameters (starting with --, not with -)

svn path=/trunk/; revision=47538
2010-06-03 14:19:18 +00:00
Eric Kohl
fc20aaf185 [NTOSKRNL]
NtDuplicateToken: If the called does not provide any desired access rights the duplicate token will inherit the granted rights of the original token.

svn path=/trunk/; revision=47535
2010-06-03 13:36:50 +00:00
Eric Kohl
65435e1b84 [SYSDM]
- Check the custom paging file sizes for being within useful limits and display warnings if these limit were exceeded.
- Translators: Please translate the message strings!

svn path=/trunk/; revision=47534
2010-06-03 13:17:33 +00:00
Timo Kreuzer
447be42c33 Merge 46523 from amd64 branch:
- Fix assert macro
- Add crt="MSVC" to a number of modules to resolve _assert

svn path=/trunk/; revision=47533
2010-06-03 12:47:40 +00:00
Cameron Gutman
520f691995 [FREELDR]
- Remove an overzealous API check and the work-around for it

svn path=/trunk/; revision=47531
2010-06-03 08:09:42 +00:00
Cameron Gutman
0f49f63b63 [FREELDR]
- Verify that Int 13 extensions are supported before trying to use them

svn path=/trunk/; revision=47530
2010-06-03 07:48:35 +00:00
Michael Martin
be344838ef [rtl]
- len returned from mbstowcs is the required size of the destination string, so only allocate the needed size.
- When doing the actual conversion pass in the size of the ansi string not the needed size of destination.
- These changes were missed in 47527.

svn path=/trunk/; revision=47529
2010-06-03 07:08:07 +00:00
Michael Martin
f6d5918b31 [crt]
- mbstowcs: Fix incorrect size passed as the second parameter for call to RtlMultiByteToUnicodeN.
Fixes loading assemblies when manifest is in a manifest file due to parsing failure.

svn path=/trunk/; revision=47527
2010-06-02 23:58:28 +00:00
Gabriel Ilardi
8f37e32fd6 [SYSDM]
- Update Italian and Spanish translations.

svn path=/trunk/; revision=47526
2010-06-02 22:49:27 +00:00
Eric Kohl
23e08cb25e [SYSDM]
- Fix a bug in the creation of the 'PagingFiles' registry value.
- Set paging file sizes only if both user defined sizes are valid numerical values and display a warning otherwise.
- Translators: Please translate the message strings!

svn path=/trunk/; revision=47525
2010-06-02 22:29:19 +00:00
Gabriel Ilardi
4fad7fd616 [usetup]
- The last error messages were swapped in some languages, spotted by Paolo Devoti.
- Added the minimum required disk space also in the debug print.
See issue #5440 for more details.

svn path=/trunk/; revision=47524
2010-06-02 22:28:37 +00:00
Giannis Adamopoulos
40ff1fac4b [win32k]
- Fix detection of file type while generating vcxproj files

svn path=/trunk/; revision=47523
2010-06-02 18:14:53 +00:00
Giannis Adamopoulos
4f491e282e [win32k[win32k]
-Allow menus to be shown over the taskbar
See issue #5415 for more details.

svn path=/trunk/; revision=47522
2010-06-02 16:55:21 +00:00
Gabriel Ilardi
c1de13be76 [netshell]
- Improve current network connection status icons.

svn path=/trunk/; revision=47521
2010-06-02 15:43:07 +00:00
Gabriel Ilardi
ee7e83a4cd Several Italian translation updates by Paolo Devoti.
See issue #5438 for more details.

svn path=/trunk/; revision=47520
2010-06-02 14:04:07 +00:00
Stefan Ginsberg
f1f3d045d4 [HAL] Fix compiler preprocessor checks for the IRQL masks so other compilers than GCC get proper entries too.
[HAL] Define the HalpHardwareInterrupt macro for MSVC too.
[HAL] Replace IRQL_DEBUG with DBG so we always check for incorrect IRQL on debug. I believe incorrect IRQL raise/lower is a common and serious enough error to always be checked for on debug builds without defining some special debug option.

svn path=/trunk/; revision=47519
2010-06-02 13:59:47 +00:00
Daniel Reimer
ebed05d2d4 Polish Translation Updates by Maciej Bialas.
svn path=/trunk/; revision=47518
2010-06-02 11:34:56 +00:00
Aleksey Bragin
840624212a [HAL]
- Fix a typo.

svn path=/trunk/; revision=47517
2010-06-02 11:26:19 +00:00
Cameron Gutman
59aacb176f [NTOSKRNL]
- Revert the hack in r47514
- The ASSERT is there to make sure the PFN lock is held
- Fix the issue properly by holding the PFN lock while initializing

svn path=/trunk/; revision=47516
2010-06-01 20:06:53 +00:00
Gregor Schneider
b5781444a5 [FONTVIEW] Select the oldest font back into the DC, leftover from bug #5182
svn path=/trunk/; revision=47515
2010-06-01 19:36:43 +00:00
Johannes Anderwald
2acf45f081 [NTOS]
- Fix assertion hit during install
- Fix identation
- Remove superflous spaces

svn path=/trunk/; revision=47514
2010-06-01 15:08:14 +00:00
Johannes Anderwald
ba2a17a2ef [NPFS]
- Fix 2 memory leaks when creating a pipe fails
- Fix minor style issue

svn path=/trunk/; revision=47513
2010-06-01 10:57:26 +00:00
Johannes Anderwald
e2be367887 [NPFS]
- Check if MmGetSystemAddressForMdlSafe failed

svn path=/trunk/; revision=47512
2010-06-01 09:52:16 +00:00
Giannis Adamopoulos
9598f59dec [rbuild]
msvc backend:
- Start implementing real support for vcxproj files
- Fix generating sln files
- Move msvc rules in a separate folder
- Various fixes

svn path=/trunk/; revision=47511
2010-06-01 09:31:24 +00:00
Art Yerkes
5fafb51079 Add invariant checks and fix a bug: Copy+Paste error misusing OldFlink
svn path=/trunk/; revision=47510
2010-06-01 09:22:10 +00:00
Johannes Anderwald
5e80db9d5e [NPFS]
- Add more buffer checks
- Clear DO_DEVICE_INITIALIZING flag

svn path=/trunk/; revision=47509
2010-06-01 09:12:32 +00:00
Johannes Anderwald
f346021e6c [NPFS]
- Return buffer size if the buffer is too small

svn path=/trunk/; revision=47508
2010-06-01 08:43:50 +00:00
Daniel Reimer
cfc0d726f2 Add the non yet working FF 3.6 and AbiWord 2.8.5 to rapps to simplify testing.
Sync the rest

svn path=/trunk/; revision=47507
2010-06-01 06:43:47 +00:00
Cameron Gutman
85c99c26cb [NPFS]
- Acquire the cancel spin lock before calling IoSetCancelRoutine
- Remove the old cancellation code
- Don't use the CCB stored in the IRP because it could be invalid depending on the state of the IRP
- Simplify thread termination
- Fixes random crash during rpcrt4:ndr_marshall test

svn path=/trunk/; revision=47506
2010-06-01 02:44:15 +00:00
Eric Kohl
f4d415767d [SMSS]
- Create a new default paging file if no paging files exist.
- Set the calculated paging file sizes in the registry.
- Remove predefined paging file name from the hivesys*.inf files.
Fixes bug #4048.

svn path=/trunk/; revision=47505
2010-05-31 22:34:16 +00:00
Gregor Schneider
19d33c5dc1 [RAPPS] Create a new download directory if the user agrees to do so, based on a patch by Seungju Kim. Translations except German and English should be updated to reflect the changed intention.
See issue #5196 for more details.

svn path=/trunk/; revision=47504
2010-05-31 20:09:13 +00:00
Gregor Schneider
86140dbf5a [EXPLORER_NEW] Display a message box if the explorer registry key cannot be loaded, patch by Katayama Hirofumi
See issue #5407 for more details.

svn path=/trunk/; revision=47503
2010-05-31 19:16:14 +00:00
Gregor Schneider
bd17e097fa [CMD] Protect certain actions with a critical section, patch by Katayama Hirofumi
See issue #5406 for more details.

svn path=/trunk/; revision=47502
2010-05-31 18:38:48 +00:00
Cameron Gutman
343454be2f [MSAFD]
- Msafd is really just a stub that points to mswsock

svn path=/branches/aicom-network-branch/; revision=47501
2010-05-31 18:17:05 +00:00
Giannis Adamopoulos
b95825c931 [win32k]
- Rename co_IntCreateWindowEx to co_UserCreateWindowEx and refactor it to make it readable
- Also fix the sequence of messages in co_UserCreateWindowEx

svn path=/trunk/; revision=47500
2010-05-31 17:58:05 +00:00
Timo Kreuzer
72cb5886ab [MMENT4]
Fix warning about uninitialized variable

svn path=/trunk/; revision=47499
2010-05-31 15:27:14 +00:00
Timo Kreuzer
c6de042447 [PSDK]
Fix braces around initializers for GUIDs
Patch by Love Nystrom

See issue #5336 for more details.

svn path=/trunk/; revision=47498
2010-05-31 15:10:25 +00:00
Timo Kreuzer
fa63efd411 [ntstrsafe.h]
- Fix a number of parameter types (LPSTR/LPCSTR instead of PCHAR, PCCHAR) This is not the same, PCCHAR is a char * not a const char *

svn path=/trunk/; revision=47497
2010-05-31 15:07:19 +00:00
Timo Kreuzer
76a1e465ea [CMIDRIVER]
- Fix a number of warnings, no actual code change
- Patch by Love Nystrom, improvements by me

See issue #5336 for more details.

svn path=/trunk/; revision=47496
2010-05-31 14:58:43 +00:00
Timo Kreuzer
f9639de590 [MMENT4]
Remove a ";" after an if (), that makes no sense and caused GetNt4SoundDeviceCapabilities to always return without doing anything.

svn path=/trunk/; revision=47494
2010-05-31 14:11:10 +00:00
Timo Kreuzer
aa42ebb18f [OSKITTCP]
Improve the reactos-hack, by changing the ";" after an "if (...)" to "(void)0;" to tell the compiler that we intentionally do nothing in the if body.

svn path=/trunk/; revision=47493
2010-05-31 14:04:24 +00:00
Timo Kreuzer
336bd01387 [LIBJPEG]
Instead of disabling a warning when using "main" as something else then the main function, define it to mainptr (it's used as a pointer variable) globally, this approach is portable.

svn path=/trunk/; revision=47492
2010-05-31 14:00:50 +00:00
Timo Kreuzer
633c71de4e [BATTC]
- define _BATTERYCLASS_ to not get dllimport specifiers

svn path=/trunk/; revision=47491
2010-05-31 13:57:33 +00:00
Timo Kreuzer
e9f941b00b [FORMAT]
Fix "potentially insecure" usage of non-string-literals in printf.

svn path=/trunk/; revision=47490
2010-05-31 13:56:29 +00:00
Timo Kreuzer
e5b901a419 [ACPI]
- Add some missing NTAPI
- Fix AcpiInterfaceConnectVector and AcpiInterfaceDisconnectVector parameters (ACPI_INTERFACE_STANDARD version 1 not version 2)
- Patch by Amine Khaldi

svn path=/trunk/; revision=47489
2010-05-31 13:54:38 +00:00
Timo Kreuzer
5168fe0e80 [MSCONFIG]
Add header guards. They are not neccessary in this case, but better to have them, especially since it uses a compilation unit.

svn path=/trunk/; revision=47488
2010-05-31 13:45:29 +00:00
Stefan Ginsberg
98ca38a88c [NTOS] Re-enable the APC debug check in the system call exit code that somehow got removed in 46247.
[NTOS] Use an inline for emitting the iret instruction in C code for portability.
[NTOS] Simplify the MSC assembly in KiSwitchToBootStack.

svn path=/trunk/; revision=47487
2010-05-31 12:52:16 +00:00
Michael Martin
11f78560e8 [win32k]
- When processing and deleting timers use a seperate timer lock instead of using the global user lock.

svn path=/trunk/; revision=47486
2010-05-31 12:36:40 +00:00
Jeffrey Morlan
46e34b5640 [WIN32CSR] Split up excessively large and disorganized conio.c into 3 separate files: one for input-related functions, one for output-related functions, and one for general/miscellaneous functions.
svn path=/trunk/; revision=47485
2010-05-31 06:28:55 +00:00
Timo Kreuzer
d3d2badfac - add explicit braces to avoid ambiguous 'else'
- fix deprecated conversion from string constant to 'char*'

svn path=/trunk/; revision=47484
2010-05-31 04:13:40 +00:00
Timo Kreuzer
b6e7912492 remove WTIME_S_DEFINED guard and move the functions from wchar_s to wchar.h (like in MS headers)
svn path=/trunk/; revision=47483
2010-05-31 03:32:51 +00:00
Timo Kreuzer
8cab5daeec [IPHLPAPI]
- remove unused variable

svn path=/trunk/; revision=47482
2010-05-31 02:29:36 +00:00
Timo Kreuzer
8deca41d3f Fix build (don't redefine structures)
svn path=/trunk/; revision=47481
2010-05-31 02:23:30 +00:00
Timo Kreuzer
62327e715f [DDK/XDK]
- Use PCI_COMMON_HEADER_LAYOUT for C, too, place it where it belongs

svn path=/trunk/; revision=47480
2010-05-31 02:15:15 +00:00
Timo Kreuzer
f0c2cec9d5 [CRT]
- add clang compatible asm version of ldexp and make the code more readable
- constify strndup parameter to match standard
- fix broken pointer comparison in signal()

svn path=/trunk/; revision=47479
2010-05-31 01:50:09 +00:00
Timo Kreuzer
1db109e182 [time.h]
Add missing asctime_s and localtime_s, don't include time_s.h anymore

svn path=/trunk/; revision=47478
2010-05-31 01:49:22 +00:00
Timo Kreuzer
2991d5eb42 [CRT]
- Don't define __int64 for clang (patch by Amine Khaldi)
- Fix file and purpose in the header

svn path=/trunk/; revision=47471
2010-05-30 22:28:00 +00:00
Cameron Gutman
5de258d708 [NPFS]
- Fix race conditions in read IRP cancellation that resulting in random crashes and hangs
- Fixes MULTIPLE_IRP_COMPLETE_REQUESTS bug checks and failed cancellations resulting in hangs during ntdll:file test

svn path=/trunk/; revision=47470
2010-05-30 22:18:50 +00:00
Timo Kreuzer
da9ba65945 [DDK/XDK]
Merge recent header changes

svn path=/branches/header-work/; revision=47467
2010-05-30 22:03:16 +00:00
Timo Kreuzer
1c2429510e [NTIFS]
Use a preprocessor definition for FSRTL_COMMON_FCB_HEADER instead of using an ms extension, that wouldn't work for ISO C

svn path=/trunk/; revision=47466
2010-05-30 22:02:42 +00:00
Timo Kreuzer
08d4b579ab [lib/3rdparty]
Disable unused value warning here, too

svn path=/trunk/; revision=47465
2010-05-30 21:32:28 +00:00
Gregor Schneider
744022564b [KERNEL32] Return nothing from InternalCopyDeviceFindDataA/W functions
svn path=/trunk/; revision=47464
2010-05-30 21:19:26 +00:00
Timo Kreuzer
06a6306fa8 [WINETESTS]
Disable unused value warnings

svn path=/trunk/; revision=47463
2010-05-30 21:01:52 +00:00
Timo Kreuzer
8da06df010 [PSEH]
Use dummy pseh for clang

svn path=/trunk/; revision=47462
2010-05-30 20:57:02 +00:00
Gregor Schneider
8117e46131 Various application fixes by Jan Roeloffzen, bug #5182, part 4/4
dxdiag: tabs -> spaces, UINT -> UINT_PTR, remove unused assignments, simplify code, fix compiler warnings

svn path=/trunk/; revision=47461
2010-05-30 20:36:20 +00:00
Gregor Schneider
ad964bddb1 Various application fixes by Jan Roeloffzen, bug #5182, part 3
arp: Remove unused variables
ftp: tabs->spaces, remove unused variables
nslookup: Remove unused variables

svn path=/trunk/; revision=47460
2010-05-30 20:31:58 +00:00
Gregor Schneider
81d25d5267 Various application fixes by Jan Roeloffzen, bug #5182, part 2
fontview: remove unused variable
kbswitch: remove unused variables
magnify: remove unused variable
mplay32: DWORD -> MCIERROR, tabs -> spaces
eventvwr: remove unused variable

svn path=/trunk/; revision=47459
2010-05-30 20:25:46 +00:00
Gregor Schneider
63313191f0 Various application fixes by Jan Roeloffzen, bug #5182, part 1
Notepad: remove unused variable, tabs -> spaces
Regedit: remove unused variable
Calc: dword->bool, remove unused variables, tabs -> spaces

svn path=/trunk/; revision=47458
2010-05-30 20:19:21 +00:00
Jeffrey Morlan
d27f068a19 [FORMATTING] Standardize win32csr to 4-space indents. Based on a patch by Adam Kachwalla [Bug 5380]. No code changes.
svn path=/trunk/; revision=47457
2010-05-30 20:00:17 +00:00
Eric Kohl
dfc4dcb9b5 [NTOSKRNL]
Make NtDuplicateToken fail if the caller tries to create a new impersonation token with a raised impersonation level. This fixes a winetest.

svn path=/trunk/; revision=47456
2010-05-30 19:46:02 +00:00
Christoph von Wittich
2e0bbab8ca [KMTEST]
cast the unused 0 in the ok macro to void to make clang happy as done for wine test.h

svn path=/trunk/; revision=47455
2010-05-30 19:37:27 +00:00
Gregor Schneider
3f536523c1 [CALC] Add units and conversion factors, patch by Andrea Maiani; nanoseconds entry added to resource files
See issue #5340 for more details.

svn path=/trunk/; revision=47454
2010-05-30 18:55:28 +00:00
Timo Kreuzer
b99bfa42f2 - partly revert r47442 and apply a working fix by guarding some prototypes of functions that exist as intrinsics in #ifdefs, so we don't use them for gcc/clang
- remove duplicated prototypes, when an inline function exists already

svn path=/trunk/; revision=47453
2010-05-30 18:46:02 +00:00
Gregor Schneider
cbb1f9480b [KBDLV] Latvian keyboard fixes by Arturs B., <mad_alchemist AT mail DOT ru>
See issue #5385 for more details.

svn path=/trunk/; revision=47452
2010-05-30 18:34:29 +00:00
Timo Kreuzer
25b2c670c4 [WINE]
Cast the unused 0 in the ok macro to void to make clang happy

svn path=/trunk/; revision=47450
2010-05-30 16:24:51 +00:00
Christoph von Wittich
8e44cb3688 [WINE]
partial sync of test.h

svn path=/trunk/; revision=47449
2010-05-30 15:37:32 +00:00
Christoph von Wittich
d6fb44f0d7 [COMCTL32_WINETEST]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47448
2010-05-30 15:19:09 +00:00
Christoph von Wittich
769948f75a [PSDK]
add missing definitions

svn path=/trunk/; revision=47447
2010-05-30 15:18:08 +00:00
Gregor Schneider
5df0484c21 [MMSYS] Load the no sound item in the shared buffer before preparing the reactos/media path for loading individual files
See issue #5436 for more details.

svn path=/trunk/; revision=47446
2010-05-30 15:13:04 +00:00
Gregor Schneider
306e2ff6f2 [MMSYS] Adjust German dialog item positions and sizes
svn path=/trunk/; revision=47445
2010-05-30 15:09:25 +00:00
Christoph von Wittich
065ed554be [PSDK]
add missing definitions

svn path=/trunk/; revision=47444
2010-05-30 15:00:04 +00:00
Timo Kreuzer
76dc595732 [DDK]
Cast the string parameter of ASSERTMSG to PCHAR to allow passing string constants which are PCCHAR without a warning.

svn path=/trunk/; revision=47443
2010-05-30 14:02:47 +00:00
Timo Kreuzer
4af7c48119 [intrin_x86.h]
- cast return value of __sync_val_compare_and_swap to make clang happy
- add __cdecl to a number of intrinsics to make them (hopefully) compatible with crt header declarations.

svn path=/trunk/; revision=47442
2010-05-30 13:02:29 +00:00
Timo Kreuzer
64fc3cd5d7 [NTDDK]
Protect IoMapTransfer from incompatible redefinition. Patch by AmineKhaldi.

svn path=/trunk/; revision=47441
2010-05-30 12:21:21 +00:00
Christoph von Wittich
07f8aeb0e8 [WS2_32]
set LastError to 0 when WSASendTo was successful

svn path=/trunk/; revision=47440
2010-05-30 11:25:21 +00:00
Christoph von Wittich
aa5ababad0 [SHDOCVW]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47439
2010-05-30 10:25:19 +00:00
Christoph von Wittich
41cf6b121f [URLMON]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47438
2010-05-30 10:20:31 +00:00
Michael Martin
7774953380 [user32]
- Pass a pointer to a structure, that holds the CallBack procedure and data, as the 5th parameter to NtUserMessageCall.
- Fix a bug In User32CallSendAsyncProcForKernel, the ArgumentLength is the size of SENDASYNCPROC_CALLBACK_ARGUMENTS.
[win32k]
- For types FNID_SENDMESSAGECALLBACK call co_IntSendMessageWithCallBack to put the message in the send queue.
- Rewrite code for when messages have a completioncallback

svn path=/trunk/; revision=47434
2010-05-30 06:23:41 +00:00
Sir Richard
c816943def [NTOS]: Implement MiAllocatePfn, it is a simpler wrapper that grabs a page, sets its protection, and initializes its PFN entry.
[NTOS]: Use MiAllocatePfn in MiLoadImageSection instead of MmAllocPage. Other than doing a better job at initializing the page, it creates our first caller of this function, great for testing, since this is a rather high-demand function, especially at boot.
Please test.

svn path=/trunk/; revision=47432
2010-05-30 03:02:39 +00:00
Gregor Schneider
a77d6480a6 [BOOTVID] Dramatically simplify 4bpp blitting routine
See issue #5103 for more details.

svn path=/trunk/; revision=47431
2010-05-29 23:54:47 +00:00
Timo Kreuzer
554237576f [_mingw.h]
Help compilation with clang. Patch by Amine Khaldi.

svn path=/trunk/; revision=47430
2010-05-29 21:48:32 +00:00
Eric Kohl
d259616ce4 [RTL]
Implement RtlEncodeSystemPointer using the user shared data cookie.

svn path=/trunk/; revision=47429
2010-05-29 21:15:48 +00:00
Eric Kohl
6af485d3aa [FORMATTING]
No code changes.

svn path=/trunk/; revision=47428
2010-05-29 20:40:28 +00:00
Sir Richard
fa9cd08b02 Timo/Physicus: Please validate for AMD64.
[NTOS]: Write down the PTE attribute flags for X86/AMD64. Timo/Physicus: Please double-check.
[NTOS]: Write down the array that converts from the MM_ protection flags arleady defined, into the appropriate PTE attribute flags that are architecture-specific.
[NTOS]: This will allow constant-time conversion of NT attributes into PTE attributes. Win32 attributes to NT attributes conversion won't be needed until VAD support.

svn path=/trunk/; revision=47427
2010-05-29 19:27:32 +00:00
Sir Richard
27957c2212 [NTOS]: Fix Implementation of BreakOnTermination -- Process Flags should be accessed with interlocked bit semantics, not through C bitfield extension.
[NTOS]: Revert 47425 and apply a better fix.

svn path=/trunk/; revision=47426
2010-05-29 19:21:08 +00:00
Eric Kohl
c5cc4a4bd7 [NTOSKRNL]
Do not use _SEH2_YIELD in NtSetInformationProcess, NtQueryInformationThread and NtSetInformationThread while a thread or process is still being referenced.

svn path=/trunk/; revision=47425
2010-05-29 19:13:19 +00:00
Sir Richard
c916ce9d20 Testers: Please pay attention to this build and test it fully:
[NTOS]: Implement MiDecrementShareCount (to start replacing MmReleasePageMemoryConsumer calls for pages that were grabbed through ARM3, not Mm).
[NTOS]: Implement MiInitializePfn (to initialize pages grabbed through ARM3/MiRemoveAnyPage instead of Mm/MmAllocPage).
[NTOS]: For stack pages, use new ARM3 PFN alloc/free routines, as a first test/beginning of the new ARM3 ABI.
[NTOS]: Implement and start using the Pending-Deletion PFN flag.
[NTOS]: As a result, for stack pages, the Transition page state will now be seen, and the new routine for re-inserting pages into the free list will now be used. Tracking of page table references is also done now for these pages (but we don't free the PT since this doesn't seem safe yet).


svn path=/trunk/; revision=47424
2010-05-29 18:33:50 +00:00
Eric Kohl
00fbba2fb4 [NTOSKRNL / RTL]
- Implement BreakOnTermination case for NtQueryInformationProcess and NtSetInformationProcess.
- Implement RtlSetProcessIsCritical.

svn path=/trunk/; revision=47423
2010-05-29 18:22:47 +00:00
Christoph von Wittich
5e8f4e5fd6 [MSHTML_WINETEST]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47422
2010-05-29 18:04:05 +00:00
Gregor Schneider
fcb1ce77af [CMD] File completion
- Don't pass device paths to FindFirstFile (similar to r47418)
- Allows to complete files, whose names start like DOS devices (COMx, LPTx. AUX, NUL, CON, etc)
See issue #4848 for more details.

svn path=/trunk/; revision=47421
2010-05-29 18:01:20 +00:00
Christoph von Wittich
4141772cae [SHLWAPI]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47420
2010-05-29 17:47:03 +00:00
Christoph von Wittich
2489a60f61 [WS2_32]
implement WSAAddressToStringA/W (taken from wine)

svn path=/trunk/; revision=47419
2010-05-29 17:33:37 +00:00
Gregor Schneider
08ca572fc4 [CMD] copy command:
- Don't pass device path to FindFirstFile, use short path instead
- Join duplicate code to simplify processing
See issue #3575 for more details.

svn path=/trunk/; revision=47418
2010-05-29 16:49:23 +00:00
Cameron Gutman
04c946cecc [NTOSKRNL]
- Fix stack skipping logic in IofCompleteRequest
- Fixes displaying MULTIPLE_IRP_COMPLETE_REQUESTS bug check
- Patch by lassy with a typo fix by me

svn path=/trunk/; revision=47417
2010-05-29 16:00:43 +00:00
Christoph von Wittich
7f10ebad54 [MSHTML]
-sync to wine 1.2 RC2
-add ros_diff.patch

svn path=/trunk/; revision=47416
2010-05-29 14:54:55 +00:00
Christoph von Wittich
bc9b61ca21 [MSHTML]
restore local mshtml changes lost by last wine sync

svn path=/trunk/; revision=47415
2010-05-29 14:44:13 +00:00
Christoph von Wittich
da3904b159 [BOOTDATA]
revert 47055

svn path=/trunk/; revision=47414
2010-05-29 14:42:39 +00:00
Christoph von Wittich
b2caf487ee [JSCRIPT]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47413
2010-05-29 14:21:43 +00:00
Christoph von Wittich
e2a40983d0 [WININET]
-sync to wine 1.2 RC2
-enable http compression with zlib

svn path=/trunk/; revision=47412
2010-05-29 13:41:35 +00:00
Daniel Reimer
85122dfdc4 Update zlib from 1.2.3 to 1.2.5
svn path=/trunk/; revision=47411
2010-05-29 13:22:48 +00:00
Christoph von Wittich
c5d6cf73b0 [CRYPT32]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47410
2010-05-29 13:14:05 +00:00
Gregor Schneider
c60e69763c [BOOTVID] Don't increment an uninitialized and unused variable, bug #5103
svn path=/trunk/; revision=47409
2010-05-29 12:57:29 +00:00
Daniel Reimer
f435dab493 Update:
DejaVu Fonts 2.30 -> 2.31
Liberation Fonts 1.04 -> 1.05.2

svn path=/trunk/; revision=47408
2010-05-29 12:47:30 +00:00
Gregor Schneider
c8e90e9d05 [KERNEL32] ReplaceFileW:
- Initialize Unicode string structure, so that only allocated buffers are freed when leaving the function
- Fixes several heap warnings in kernel32:file test

svn path=/trunk/; revision=47407
2010-05-29 12:31:48 +00:00
Gregor Schneider
24dd4301ad [KERNEL32] WaitNamedPipeW: Free Unicode buffer when leaving the function
svn path=/trunk/; revision=47406
2010-05-29 12:29:26 +00:00
Christoph von Wittich
c48e118c70 [OLE32]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47405
2010-05-29 11:34:57 +00:00
Christoph von Wittich
1d5afb8039 [CRT]
fix behavior of _system (fixes msvcrt environ winetest)

svn path=/trunk/; revision=47403
2010-05-29 09:23:23 +00:00
Christoph von Wittich
e701f228c2 [MSVCRT_WINETEST]
partial sync to wine 1.2 RC2

svn path=/trunk/; revision=47402
2010-05-29 09:22:07 +00:00
Christoph von Wittich
b6ed2f2fbf [QUARTZ]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47401
2010-05-29 09:07:32 +00:00
Christoph von Wittich
cdabe0cf21 [QEDIT]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47400
2010-05-29 09:05:43 +00:00
Christoph von Wittich
def4a5f1f5 [RSAENH]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47399
2010-05-29 09:03:59 +00:00
Christoph von Wittich
bc732ca2d3 [MSXML3]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47398
2010-05-29 09:02:25 +00:00
Christoph von Wittich
348790ffe6 [MSI]
sync to wine 1.2 RC2

svn path=/trunk/; revision=47397
2010-05-29 08:55:43 +00:00
Christoph von Wittich
11ebf0a0dc [MSI]
delete msi_ros.diff

svn path=/trunk/; revision=47394
2010-05-29 08:01:25 +00:00
Michael Martin
a8a65751a3 [win32k]
- The timer is created usingUserCreateObject. It may be a good idea to save the handle in the timer object so that it can be deleted later.
- Dereference the object before attempting to delete it.

svn path=/trunk/; revision=47393
2010-05-29 06:51:03 +00:00
Amine Khaldi
9c2f5ba446 [XDK]
- Add some missing definitions.
[DDK]
- Update ntddk.h to reflect recent XDK changes.

svn path=/branches/header-work/; revision=47392
2010-05-29 00:30:18 +00:00
Cameron Gutman
61325bb279 [NTOSKRNL]
- Set the Status variable to STATUS_SUCCESS in PIP_RETURN_DATA
- Fixes testbot

svn path=/trunk/; revision=47391
2010-05-29 00:29:12 +00:00
Cameron Gutman
848f77424e [NTOSKRNL]
- Use PnpDetermineResourceListSize to determine the resource list size and remove the broken IopCalculateResourceListSize function

svn path=/trunk/; revision=47390
2010-05-28 23:17:59 +00:00
Sir Richard
58055397a5 [NTOS]: Root Bus PDO should not override Status with STATUS_NOT_IMPLEMENTED and instead use the current IRP status (which drivers/PnP will typically set to STATUS_NOT_SUPPORTED). Found by testing the new PCIx driver (probably fixes other bus drivers too).
svn path=/trunk/; revision=47389
2010-05-28 23:08:41 +00:00
Sir Richard
6b6a3291e8 [NTOS]: Re-implement IoGetDeviceProperty. Main changes are usage of existing (and new) helper functions for registry/IRP access, much better factored code, correct implementation of DevicePropertyPhysicalDeviceObjectName, fixed implementation of DevicePropertyBootConfigurationTranslated and DevicePropertyBootConfiguration (do not crash the system anymore), and support for more device properties.
[NTOS]: Fix caller of IoGetDeviceProperty in pnpres.c to work with new function behavior (which matches WDK documentation and test cases).
[NTOS]: Implement helper function PnpBusTypeGuidGet, should be used later in other PnP code, but now used only for this patch.
[NTOS]: Implement helper function PnpDetermineResourceListSize, ditto. N.B. Current IopCalculateResourceListSize function is broken and callers should use this one instead.
[NTOS]: Implement helper function PpIrpQueryCapabilities, should be used later in device node code, but now only used for this patch.
[NTOS]: Implement helper function PnpDeviceObjectToDeviceInstance, ditto.
Main purpose of this patch is to unblock the new PCIx driver.

svn path=/trunk/; revision=47388
2010-05-28 23:03:27 +00:00
Cameron Gutman
799b6ad5b8 [FREELOADER]
- Fix DoOptionsMenu and implement AppendBootOptions to support F8 boot options
- Fixes bug 5363

svn path=/trunk/; revision=47387
2010-05-28 22:54:27 +00:00
Michael Martin
18c065e00d [win32k]
- Remove use of TMRF_DELETEPENDING for deleting timers as this was a bad idea. 
Timers need to be deleted immediately as waiting for them to be deleted resulted in some processes running out of handles.
Fixes richedit winetest for editor.
- Add flag TMRF_TIFROMWND for timers created from user mode so the thread stored in the timer object is from the window and not caller.
Fixes an issue where FireFox would not show any of its windows and looked dead.
- When creating and deleting timers, If the window is non null and IDEvent is 0 then the IDEvent is changed to 1.
- When modifying timer list use UserEnter and Leave instead of a Critical Region only.

svn path=/trunk/; revision=47385
2010-05-28 20:35:30 +00:00
Eric Kohl
f9cd9b9a5b [NTOSKRNL]
- Implement SeAppendPrivileges().

svn path=/trunk/; revision=47384
2010-05-28 19:36:57 +00:00
Eric Kohl
f0910f33d3 [FORMATTING]
No code changes.

svn path=/trunk/; revision=47383
2010-05-28 16:28:27 +00:00
Eric Kohl
4e25539b71 [NTOSKRNL]
Implement SeFreePrivileges().

svn path=/trunk/; revision=47382
2010-05-28 15:03:09 +00:00
Cameron Gutman
d30c42f367 [MSAFD]
- Fix a broken call to WSPBind that I missed in r47378

svn path=/trunk/; revision=47380
2010-05-28 05:15:42 +00:00
Cameron Gutman
d36292eecf [TCPIP]
- Return STATUS_INVALID_ADDRESS if the caller tries to get a non-local address
- Return STATUS_ADDRESS_ALREADY_EXISTS if the caller uses an address that is in use
[MSAFD]
- Translate STATUS_ADDRESS_ALREADY_EXISTS -> WSAEADDRINUSE, STATUS_LOCAL_DISCONNECT -> WSAECONNABORTED, and STATUS_REMOTE_DISCONNECT -> WSAECONNRESET
[IP]
- Translate OSK_EADDRINUSE -> STATUS_ADDRESS_ALREADY_EXISTS, OSK_ECONNABORTED -> STATUS_LOCAL_DISCONNECT, and OSK_ECONNRESET -> STATUS_REMOTE_DISCONNECT
- Fixes waiting for binding during ws2_32 sock winetest

svn path=/trunk/; revision=47379
2010-05-28 04:39:49 +00:00
Cameron Gutman
54b6aff827 [MSAFD]
- Pass a valid pointer for lpErrno to WSPBind when performing an implicit bind
- Remove the hack in MsafdReturnWithErrno for dealing with stupid callers that provide don't provide a valid Errno pointer

svn path=/trunk/; revision=47378
2010-05-28 04:07:39 +00:00
Cameron Gutman
219cc11d6a [MSAFD]
- Remove an incorrect change
- Create a new function called TranslateNtStatusError to translate NTSTATUS to winsock error codes
- Call the TranslateNtStatusError in MsafdReturnWithErrno and also use it to translate AFD's poll event error codes
[AFD]
- Track the status for each poll event in our FCB and copy it back when we get an IOCTL_AFD_ENUM_NETWORK_EVENTS IRP
- Remove some useless PollReeval calls

svn path=/trunk/; revision=47377
2010-05-28 03:55:50 +00:00
Cameron Gutman
f06be4552d [MSAFD]
- Zero the entire struct not just the lpNetworkEvents member
- Write the error codes returned from AFD to the iErrorCode array
- Fixes hundreds of ws2_32_winetest sock failures (only 104 failures now)
- Dedicated to Physicus

svn path=/trunk/; revision=47376
2010-05-28 02:25:56 +00:00
Cameron Gutman
f73d8199f7 [NPFS]
- Partially revert r47370 and apply a better patch
- Change ReadEvent and WriteEvent to notification events because we reset those events manually when we run out of buffer space

svn path=/trunk/; revision=47375
2010-05-27 23:52:32 +00:00
Eric Kohl
b85a7deb22 The global flag FLG_HEAP_ENABLE_CALL_TRACING has been replaced by FLG_ENABLE_SYSTEM_CRIT_BREAKS in Windows XP and above.
svn path=/trunk/; revision=47374
2010-05-27 20:15:35 +00:00
Benedikt Freisen
011d911b66 [PAINT]
- After clearing a new selection and creating an undo-step, draw selection contents
- Fixes bug #5246

svn path=/trunk/; revision=47373
2010-05-27 14:53:53 +00:00
Benedikt Freisen
c63cf6931f [PAINT]
- Improvements by Black_Fox, see bug #5418
- Readability improvement, patch by Katayama Hirofumi, see  bug #5420

svn path=/trunk/; revision=47372
2010-05-27 12:21:50 +00:00
Kamil Hornicek
5989fa66dd - Sync wined3d, ddraw, d3d8, d3d9 with Wine
svn path=/trunk/; revision=47371
2010-05-27 10:25:14 +00:00
Cameron Gutman
7c79933df4 [NPFS]
- Change the other side's to PIPE_STATUS_CLOSING_STATE in NpfsCleanup and NpfsClose so the reading/writing thread knows that the pipe is dead when we signal its event
- Fixes iphlpapi_winetest hang and possibly bug #4689

svn path=/trunk/; revision=47370
2010-05-27 00:26:34 +00:00
Timo Kreuzer
5faac22844 [WIN32K]
GreGradientFill: don't forget to unlock the DC

svn path=/trunk/; revision=47367
2010-05-26 22:33:10 +00:00
Hervé Poussineau
24c7a10807 [freeldr] Repair NTFS driver. ReactOS is now able to boot (again) from NTFS partitions
svn path=/trunk/; revision=47365
2010-05-26 19:58:54 +00:00
Hervé Poussineau
82c609eda0 [freeldr] Disable NTFS cache because it gives wrong results
svn path=/trunk/; revision=47364
2010-05-26 19:56:07 +00:00
Timo Kreuzer
21e28a541f [FREETYPE]
Update to 2.3.12, conversion patch already applied

svn path=/trunk/; revision=47363
2010-05-26 11:30:35 +00:00
Gabriel Ilardi
7dc83b2932 [USETUP]
- Spanish translation update by Javier Remacha. Fixes bug 4367.
- Fixed a typo in Italian and English.

- Some other Spanish and Italian translation updates by Javier and me.

svn path=/trunk/; revision=47362
2010-05-26 11:28:02 +00:00
Timo Kreuzer
66aae4c0fa [FREETYPE]
- Cleanup old files
- Remove setjmplongjmp.s
- Correction to last commit message: the conversion patch was already applied

svn path=/trunk/; revision=47361
2010-05-26 11:07:12 +00:00
Timo Kreuzer
7c79bc896d [FREETYPE]
Patch by Jerome Gardou: Update freetype to 2.3.9
The FT_MulFix patch is not neccessary anymore, the 1BPP -> 8BPP conversion patch will be applied again right after this.
See issue #4537 for more details.

svn path=/trunk/; revision=47360
2010-05-26 10:40:15 +00:00
Jeffrey Morlan
1594c9f594 [WIN32CSR] Implement console pausing. [Bug 4739]
svn path=/trunk/; revision=47359
2010-05-26 04:57:45 +00:00
Michael Martin
bbe7ec53c5 [win32k]
- Implement DestroyTimersForWindow and call it instead of MsqRemoveTimersWindow when destroying a window.
- Fire NewMessages event when cleaning up thread so that threads dont wait for new messages that will never be received. Fixes a problem where some application that use timers dont completly exit.
- IntSetTimer: Dont try to raise a timer from the dead. Once the TMRF_DELETEPENDING flag is set, let it be destroyed.
- co_MsqWaitForNewMessages: Call the wait without a timeout value as now when the timer expires the NewMessages event will be set to exit the wait.
- Message Queue specific timer code and old time queuing code is now dead. It will be removed later when we are happy with new timer implementation.

svn path=/trunk/; revision=47358
2010-05-26 02:04:09 +00:00
Gabriel Ilardi
7f82a194fa [USETUP]
- Estonian translation of minimum disk space required by Andres Traks #3302.
[USERENV]
- Fix mistakenly translated strings "recent" and "sendto" in Italian and Spanish resources, plus another Spanish fix.
Several Czech translation updates by Radek Liska #5429.

svn path=/trunk/; revision=47351
2010-05-25 13:42:30 +00:00
Timo Kreuzer
714a181969 [WIN32K]
Refactor NtGdiGradientFill, use 1 SEH block instead of 2, replace IntGdiGradientFill with GreGradientFill, don't lock the DC in UserDrawCaption.

svn path=/trunk/; revision=47350
2010-05-25 11:55:04 +00:00
Timo Kreuzer
71d693cef0 [WIN32K]
Delete old clipregion only and set a new one, if it could be created already, to avoid setting a NULL region.

See issue #4431 for more details.

svn path=/trunk/; revision=47349
2010-05-25 11:41:29 +00:00
Michael Martin
bb079cacb0 [win32k]
- Minor revert of 47281 to fix OO installer textboxes.

svn path=/trunk/; revision=47348
2010-05-25 10:33:13 +00:00
Gabriel Ilardi
d514045177 [USETUP]
- Polish and Czech (#5429) translations of required disk space by Maciej Bialas and Radek Liska
- Some fixes and updates to Italian and Spanish resources

svn path=/trunk/; revision=47346
2010-05-25 08:16:09 +00:00
Eric Kohl
1605abd1bc [USETUP]
Make the required minimum disk space configurable from the txtsetup.sif file.

svn path=/trunk/; revision=47345
2010-05-24 22:32:23 +00:00
Eric Kohl
bd925f8147 [USETUP]
Made the 'Copying file...' status line message left aligned like all the other status line messages.

svn path=/trunk/; revision=47343
2010-05-24 21:43:51 +00:00
Eric Kohl
6ed709da3d [USETUP]
- Add german translation of required minimum disk space warning.

svn path=/trunk/; revision=47342
2010-05-24 21:08:06 +00:00
Gabriel Ilardi
d1f4ced4ab [USETUP]
- Check for required minimum disk space eventually warn the user.
- Added Italian and Spanish warnings, the other languages need translation.
- Patch by R.T.Sivakumar modified by me.
See issue #3302 for more details.

svn path=/trunk/; revision=47341
2010-05-24 20:53:32 +00:00
Timo Kreuzer
8a591ca9df [WIN32K / WIN32CSR]
Get rid of FASTCALL specifier for static functions and functions with no parameters.

svn path=/trunk/; revision=47340
2010-05-24 13:34:08 +00:00
Timo Kreuzer
c970cbb191 [WIN32K]
When destroying a window, generate a mouse move message, so that the underlying window is notified about the mouse position and can update the pointer if neccessary. Fixes bug #4499 and bug #3893

See issue #4499 for more details.

svn path=/trunk/; revision=47339
2010-05-24 12:57:03 +00:00
Aleksey Bragin
c386b1ee3b - Revert 47310. Please find a way to enable kmtest only when building the testing cd image, not the installation/live one.
svn path=/trunk/; revision=47338
2010-05-24 08:51:52 +00:00
Jeffrey Morlan
975502bb74 [WIN32CSR] fix tuiconsole
svn path=/trunk/; revision=47337
2010-05-24 00:04:56 +00:00
Eric Kohl
4841dde246 [SMSS]
- Add the system environment variables PROCESSOR_LEVEL and PROCESSOR_REVISION.

svn path=/trunk/; revision=47336
2010-05-23 23:41:16 +00:00
Jeffrey Morlan
7fa77031b0 [WIN32CSR]
- Make consistent use of RECT/SMALL_RECT structures: a RECT uses pixel coordinates relative to the window client area and is endpoint-exclusive; a SMALL_RECT uses character coordinates relative to the screen buffer and is endpoint-inclusive.
- Allow text selections outside of the visible window
- Implement GetConsoleSelectionInfo

svn path=/trunk/; revision=47335
2010-05-23 22:38:16 +00:00
Eric Kohl
8f6739ed2e [REGEDIT]
Ignore the case when sorting value names.

svn path=/trunk/; revision=47334
2010-05-23 20:41:03 +00:00
Eric Kohl
88637f32f5 [SMSS]
- Remove the system environment variable OS from the hivesys*.inf files.
- Change the type of the system environment variable PATHEXT in the hivesys*.inf files from REG_EXPAND_SZ to REG_SZ.
- Let SMSS add the system environment variables OS and NUMBER_OF_PROCESSORS to the registry.

svn path=/trunk/; revision=47333
2010-05-23 19:27:04 +00:00
Jeffrey Morlan
4b687b2792 [KERNEL32], [WIN32CSR] More fixes for console winetest
- BasepInitConsole: Initialize console input EXE name
- GetConsoleProcessList: Use capture buffer; only copy IDs if buffer has enough room for all of them; return total number of processes.

svn path=/trunk/; revision=47331
2010-05-23 17:40:54 +00:00
Eric Kohl
4bba2335c0 [SMSS]
- Remove the system environment variable PROCESSOR_ARCHITECTURE from the hivesys*.inf files.
- Let SMSS add the system environment variables PROCESSOR_ARCHITECTURE and PROCESSOR_IDENTIFIER to the registry.

svn path=/trunk/; revision=47330
2010-05-23 17:28:06 +00:00
Gabriel Ilardi
7a2b3d46d3 [INTL]
- Polish translation of Metric and Imperial by Olaf Siejka.

svn path=/trunk/; revision=47329
2010-05-23 17:07:56 +00:00
Gabriel Ilardi
fd303a1a46 [REGEDIT]
- Don't display "finished" message if search is aborted.
Patch by Katayama Hirofumi.
See issue #5421 for more details.

svn path=/trunk/; revision=47328
2010-05-23 17:01:06 +00:00
Sylvain Petreolle
772c56e48d Perform case insensitive comparison against the selected language id.
svn path=/trunk/; revision=47327
2010-05-23 16:26:11 +00:00
Jeffrey Morlan
44ce7e4f55 [KERNEL32], [WIN32CSR] Implement the CREATE_NO_WINDOW flag which creates a console with an invisible window.
svn path=/trunk/; revision=47326
2010-05-23 15:56:37 +00:00
Michael Martin
38734242d5 [win32k]
- For the Low Level Mouse Hook (WH_MOUSE_LL), input can come from the mouse driver or mouse_event. Both of which result in a call to UserSetCursorPos.
UserMode SetCursorPos API also ends up here. Add BOOL parameter that can be used to determine if hooks are to be called.
- Move the code related to calling the hook procedure from MsqInsertSystemMessage into UserSetCursorPos and call the hook procedure here if needed.
If hook procedure returns non 0 value. Dont insert the system message.
- Fixes a recursive call to the hook procedure resulting thread using to much stack exposed by user32 winetest for input.

svn path=/trunk/; revision=47325
2010-05-23 11:53:01 +00:00
Eric Kohl
dcc025f6e3 [WINLOGON]
- Set the APPDATA environment variable without loading shell32.dll.
This should fix bug #5398.

svn path=/trunk/; revision=47324
2010-05-23 11:35:08 +00:00
Giannis Adamopoulos
89b45a7e71 [kernel32_winetest]
- kernel32 tests need a resource file

svn path=/trunk/; revision=47322
2010-05-23 10:59:41 +00:00
Jeffrey Morlan
0b077c2961 [WIN32CSR] Implement FILE_SHARE_* flags for console handles. Fixes some more winetests.
svn path=/trunk/; revision=47319
2010-05-23 09:10:02 +00:00
Jeffrey Morlan
85b0f2bc12 [WIN32CSR] Delete even the active screen buffer when all handles are closed. Fixes a winetest.
svn path=/trunk/; revision=47318
2010-05-23 06:04:15 +00:00
Jeffrey Morlan
3c777cde9c [WIN32CSR]
- Simplify locking: having a lock for each screen buffer is overkill since most programs only use one screen buffer at a time. (besides, almost all APIs were taking the console lock anyway) Reduce to just having one lock for a console.
- Instead of keeping track of how many references a screen buffer has, keep track of handles only.  When all handles to a screen buffer are closed, it should be deleted even if it's the active buffer (not yet implemented).

svn path=/trunk/; revision=47317
2010-05-23 05:33:21 +00:00
Jeffrey Morlan
ff2f27f29b [WIN32CSR] Protect ProcessData->Console with the HandleTableLock.
svn path=/trunk/; revision=47316
2010-05-23 02:58:23 +00:00
Jeffrey Morlan
8686d42f93 [WIN32CSR] Clean up the debris from r47314: Removed some redundant code, reorganized headers, fixed win32csr.rbuild indentation
svn path=/trunk/; revision=47315
2010-05-23 00:51:29 +00:00
Jeffrey Morlan
7d27afbe96 [CSRSRV], [WIN32CSR]
- Move code for managing console handles from csrsrv to win32csr, where the rest of the console code is. No changes in functionality intended.
- Unify the csrsrv->win32csr callbacks (now numbering 4) into one table to avoid excessive code duplication.

svn path=/trunk/; revision=47314
2010-05-22 23:47:54 +00:00
Jeffrey Morlan
a2c5273653 [WIN32CSR] Make CsrFreeConsole close the process's console handles.
svn path=/trunk/; revision=47313
2010-05-22 21:40:20 +00:00
Eric Kohl
6a0342f830 [INTL]
Translation for entries added by r47298.
Patch by Radek Liska. Fixes bug #5416.

svn path=/trunk/; revision=47312
2010-05-22 20:27:14 +00:00
Eric Kohl
dc17a010c9 [DEVMGR]
devman.dll improvements by Viliam Lejcik:

- display version info for selected driver file in 'Driver File Details' dialog
- resource modification - changed some labels to read-only editboxes

Fixes bug #4875.

svn path=/trunk/; revision=47311
2010-05-22 20:10:52 +00:00
Cameron Gutman
9b0af1861b [HIVESYS.INF]
- Enable kmtest

svn path=/trunk/; revision=47310
2010-05-22 18:34:54 +00:00
Cameron Gutman
afcd401a32 [KMTEST]
- Add support for recovering from crashed tests
- Add check to prevent us from running the test every boot
- Delete some useless code
- Record test result information in the registry
- Under the Kmtest\Parameters key, you will find CurrentStage which is the stage that testing is on (almost always 8 if it boots). You will also find <Test Name>SuccessCount which is the number of successful tests, <Test Name>FailureCount which is the number of failed tests, <Test Name>TotalCount which is the total number of tests, and <Test Name>SkippedCount which is the number of tests that have been skipped
- Enjoy your reg testing! :)

svn path=/trunk/; revision=47309
2010-05-22 18:34:01 +00:00
Cameron Gutman
d7bbeaed19 [NTOSKRNL]
- Print a warning instead of crashing when a driver provides a NULL pointer in the MajorFunction array

svn path=/trunk/; revision=47308
2010-05-22 16:12:59 +00:00
Cameron Gutman
df9115f1d2 [NTOSKRNL]
- Free the string buffer after the DPRINT1 that prints the contents of the string
- Fixes debug print corruption found by kmtest

svn path=/trunk/; revision=47307
2010-05-22 16:03:25 +00:00
Cameron Gutman
fdbfc02407 [REACTOS.DFF]
- Add kmtest.sys and kmtestassist.sys to bootcd (optional)

svn path=/trunk/; revision=47306
2010-05-22 15:28:23 +00:00
Gregor Schneider
be753549c2 [SHELL32]
- Duplicate the string instead of freeing the memory twice at two different positions
- Fixes a heap warning when stating cmd from the desktop
See issue #4924 for more details.

svn path=/trunk/; revision=47305
2010-05-22 15:16:14 +00:00
Amine Khaldi
19ed67279d [NTOSKRNL]
- Use MiGetPdeOffset macro instead of ADDR_TO_PDE_OFFSET.

svn path=/branches/header-work/; revision=47303
2010-05-22 14:24:06 +00:00
Amine Khaldi
cde2dc6dc4 [NTOSKRNL]
- Add missing PDE_MAPPED_VA definition from the sync.

svn path=/branches/header-work/; revision=47302
2010-05-22 13:53:20 +00:00
Amine Khaldi
b1dae6b379 Sync up to trunk head.
svn path=/branches/header-work/; revision=47301
2010-05-22 13:41:48 +00:00
Gabriel Ilardi
8762a0ee20 [INTL]
Translate 'Metric' and 'Imperial' strings into Italian and Spanish.

svn path=/trunk/; revision=47299
2010-05-22 10:49:28 +00:00
Eric Kohl
8c14d43819 [INTL]
- Replace hard-coded unit strings ('Metric' and 'Imperial') by resource strings.
- Add the required resource strings to all supported languages.
- Translators: Please translate these strings.

svn path=/trunk/; revision=47298
2010-05-22 10:20:56 +00:00
Timo Kreuzer
654ef19f70 [WIN32K]
Remove WS_EX_SETANSICREATOR from Ex style in co_IntCreateWindowEx

svn path=/trunk/; revision=47297
2010-05-22 02:42:38 +00:00
Timo Kreuzer
411d634720 [USER32]
Fix uninitialized variable

svn path=/trunk/; revision=47296
2010-05-22 02:32:28 +00:00
Timo Kreuzer
709fe1efef [WIN32K / USER32]
Convert the window text string from UNICODE_STRING to LARGE_STRING and fix NtUserCreateWindowEx parameters. We currently still pass UNICODE only LARGE_STRINGs, as the rest of the code in win32k expects this.
Fixes display of large text windows, like the winzip license.
See issue #2900 for more details.

svn path=/trunk/; revision=47295
2010-05-22 01:05:31 +00:00
Cameron Gutman
c7ae2ad589 [IPHLPAPI]
- Fix some code left over from a previous attempt

svn path=/trunk/; revision=47294
2010-05-21 20:17:35 +00:00
Cameron Gutman
763cb9ff23 [DHCPCSVC]
- Remove the unused include folder

svn path=/trunk/; revision=47293
2010-05-21 20:16:48 +00:00
Cameron Gutman
0a0e20e1bd [DHCP/DHCPCSVC]
- Restore the SVN history
- Part 3 of 3 (hopefully)

svn path=/trunk/; revision=47292
2010-05-21 20:14:56 +00:00
Cameron Gutman
2835ee84ed [DHCP]
- Restore SVN history
- Part 2 of x

svn path=/trunk/; revision=47291
2010-05-21 19:30:13 +00:00
Cameron Gutman
6236312734 [DHCPCSVC]
- Restore SVN history
- Part 1 of x

svn path=/trunk/; revision=47290
2010-05-21 19:22:09 +00:00
Cameron Gutman
2b3f32398d DHCPCSVC]
- Move code from dhcp to dhcpcsvc
- Export ServiceMain from dhcpcsvc
- Now our DHCP service is compatible with the Windows architecture
[DHCP]
- Remove dhcp from build
[IPHLPAPI]
- Use dhcpcsvc APIs to control the DHCP service
- Add a missing DhcpCApiInitialize
- Fix include path in the rbuild file
[BOOTDATA]
- Add DHCP to the service list to be loaded by svchost in the netsvcs group
- Add the correct registry keys in the DHCP service key for loading by svchost
- Remove dhcp.exe from bootcd

- Part 3 of 3

svn path=/trunk/; revision=47288
2010-05-21 06:08:15 +00:00
Cameron Gutman
83add143de [DHCP]
- Delete the old DHCP service
- Part 2 of x

svn path=/trunk/; revision=47287
2010-05-21 05:57:05 +00:00
Cameron Gutman
5ef4b66b1a [DHCP]
- Delete the old dhcp service
- Part 1 of x

svn path=/trunk/; revision=47286
2010-05-21 05:44:35 +00:00
Michael Martin
a8e5ba3485 [win32k]
- Move the initialization of MasterTimer into InitInputImp which is called from win32k DriverEntry routine instead of initializing it in the secondary thread RawInputThreadMain.


svn path=/trunk/; revision=47285
2010-05-20 21:45:15 +00:00
Michael Martin
c88634cff4 [win32k]
- Set MasterTimer initial value to NULL and Initialize MasterTimer at the beginning of RawInputThreadMain before doing anything else.
- Add ASSERTs to catch if MasterTimer is NULL.


svn path=/trunk/; revision=47284
2010-05-20 21:07:53 +00:00
Giannis Adamopoulos
8576b9c8e0 [win32k]
-Remove an incorrect debug message and silence one

svn path=/trunk/; revision=47283
2010-05-20 12:25:50 +00:00
Timo Kreuzer
8064ef2967 [WIN32CSR]
Silence a debugprint

svn path=/trunk/; revision=47282
2010-05-19 22:15:49 +00:00
Giannis Adamopoulos
1e017bbd40 [win32k]
-Correctly adjust values returned from co_WinPosGetMinMaxInfo

svn path=/trunk/; revision=47281
2010-05-19 19:08:25 +00:00
Giannis Adamopoulos
3bafe5c68b [win32k]
-Sync co_WinPosGetMinMaxInfo with wine

svn path=/trunk/; revision=47280
2010-05-19 18:47:39 +00:00
Gabriel Ilardi
2d1481080b [userenv]
german translation of sendto
Patch by Egon Ashrafinia
See issue #5411 for more details.

svn path=/trunk/; revision=47277
2010-05-19 12:53:03 +00:00
Gabriel Ilardi
6f63efe38d [userenv]
- Fix Italian commonfiles
- Fix a typo and some Spanish environment variables

svn path=/trunk/; revision=47276
2010-05-19 12:03:41 +00:00
Giannis Adamopoulos
1cb77963b2 [win32k]
-Store the monitor work area in the monitor and not in the desktop

svn path=/trunk/; revision=47275
2010-05-19 11:50:21 +00:00
Giannis Adamopoulos
0a81d8d27b [win32k]
-WM_WINDOWPOSCHANGED should contain the final window position

svn path=/trunk/; revision=47273
2010-05-19 09:18:24 +00:00
Cameron Gutman
4b41a0b347 [QMGR]
- Add the FLG_ADDREG_APPEND flag when writing the netsvcs value because, unlike WINE, we are actually going to have values in there

svn path=/trunk/; revision=47268
2010-05-18 22:48:09 +00:00
Cameron Gutman
43d6b32a83 [SETUPAPI]
- Fix an incorrect length value that corrupted REG_MULTI_SZ values when they had strings appended
- I'm not sure if this is synced with WINE, but if it is, they need this patch too

svn path=/trunk/; revision=47267
2010-05-18 22:43:02 +00:00
Sylvain Petreolle
430ba4ba96 Add SvcHost registry entries.
svn path=/trunk/; revision=47266
2010-05-18 22:35:00 +00:00
Gregor Schneider
aa35f26fa9 [REGEDIT]
- Japanese resource fix by Katayama Hirofumi
- Adopt making the abort search button default for all languages
See issue #5409 for more details.

svn path=/trunk/; revision=47265
2010-05-18 17:40:38 +00:00
Giannis Adamopoulos
0ac861114e [Win32k]
- Rename co_InflateRect to RECTL_vInflateRect and move it to rect.c
- Sync WinPosFillMinMaxInfoStruct with wine
Fixes some user32:win tests

svn path=/trunk/; revision=47264
2010-05-18 09:01:08 +00:00
Michael Martin
9a41b998c7 [Kernel32]
- Implement UTF7 Support. Patch by Katayama Hirofumi.

svn path=/trunk/; revision=47263
2010-05-18 06:34:48 +00:00
Cameron Gutman
4ffa471abf [QMGR]
- Don't bulldoze our netsvcs key to install a service that doesn't even work yet

svn path=/trunk/; revision=47262
2010-05-18 01:23:57 +00:00
Timo Kreuzer
eaa70d8318 [USER32]
Patch by Benedikt Freisen: Fix wrong vertical position when painting 3D bottom line in menus.

See issue #4906 for more details.

svn path=/trunk/; revision=47260
2010-05-17 22:56:24 +00:00
Timo Kreuzer
d30bfb803d [USER32_WINETEST]
skip TrackPopupMenu, which leads to a hang on reactos

See issue #5405 for more details.

svn path=/trunk/; revision=47259
2010-05-17 22:45:28 +00:00
Amine Khaldi
e83facdb84 [NTOSKRNL]
- Add KiGetSecondLevelDCacheSize (for all the available architectures) and MiGetPdeOffset macros.
- Remove conflicting PDE_SIZE definitions (both aren't used anywhere).
- Fix ValidKernelPde, PointerPte and PointerPde types and correct their use (mminit.c).
- Thanks to the work that was done over the recent commits (in the header branch) and this one, the kernel now builds (but doesn't link yet) for ARM.

svn path=/branches/header-work/; revision=47258
2010-05-17 21:26:51 +00:00
Eric Kohl
ba5f9da4a0 Assign remaining services to the LocalSystem account.
svn path=/trunk/; revision=47256
2010-05-17 20:21:27 +00:00
Gregor Schneider
d5ebb5d18d [WIN32CSR]
- Fix a FIXME: convert ASCII char to Unicode char with input codepage
- Rename define parameters to make sense (prefix s - source, d - destination)

svn path=/trunk/; revision=47255
2010-05-17 18:43:21 +00:00
Timo Kreuzer
1b8056c3a3 [HAL]
comment out some amd64 specific stuff from rbuild files.

svn path=/trunk/; revision=47254
2010-05-17 14:52:00 +00:00
Michael Martin
e7a46576e2 [regedit]
- Woops, forgot to change the messages to use resource files instead. Thanks Gregor Schneider.

svn path=/trunk/; revision=47252
2010-05-17 12:31:06 +00:00
Michael Martin
1503e2b8c9 [regedit]
- If a search was never done, show the find dialog when pressing F3. Patch by Radek Liska.  See Bug #5391.
- Return the result of the FindNext and if it is false inform the user that search is complete.

svn path=/trunk/; revision=47251
2010-05-17 02:15:50 +00:00
Michael Martin
6666b6b68b [win32k]
- Check that the thread is not in cleanup before attempting to do anything related to it. Add a couple asserts for sanity.

svn path=/trunk/; revision=47249
2010-05-17 00:01:26 +00:00
Timo Kreuzer
39c39d457f [ReactOS-arm.rbuild]
- add newinflib to arm builds

svn path=/trunk/; revision=47248
2010-05-16 23:07:44 +00:00
Amine Khaldi
995ef3a334 [VERSION]
- Update the referencing of IMAGE_RESOURCE_DIRECTORY_ENTRY fields (the structure was updated in the previous commit).

svn path=/branches/header-work/; revision=47247
2010-05-16 22:39:59 +00:00
Timo Kreuzer
4833210740 [KERNEL32]
Protect GlobalLock, GlobalUnlock and GlobalSize with SEH, use IsBadReadPtr in GlobalLock. Inspired by wine code. Fixes user32_winetest dde crash.

svn path=/trunk/; revision=47246
2010-05-16 22:24:26 +00:00
Amine Khaldi
ac05d7c73c [PSDK]
- winnt.h : ULONG -> DWORD and UCHAR-> BYTE in several structures, update SLIST_HEADER and co, add proper packing of RTL_CRITICAL_SECTION, update IMAGE_AUX_SYMBOL, ReplacesCorHdrNumericDefines, IMAGE_COR20_HEADER, IMAGE_RESOURCE_DIRECTORY_ENTRY, IMAGE_RUNTIME_FUNCTION_ENTRY, SYSTEM_POWER_CAPABILITIES, ACTIVATION_CONTEXT_INFO_CLASS and HEAP_INFORMATION_CLASS, replace IMAGE_LOAD_CONFIG_DIRECTORY with IMAGE_LOAD_CONFIG_DIRECTORY{32,64} with the appropriate conditional and apply consistent formatting for the rest.

svn path=/branches/header-work/; revision=47245
2010-05-16 22:15:24 +00:00
Sylvain Petreolle
46b55c3dc2 Translate Common files for french as well.
svn path=/trunk/; revision=47243
2010-05-16 14:08:04 +00:00
Eric Kohl
ddf4c022d0 Translate "Common Files" string. Fixes a partially translated environment variable.
svn path=/trunk/; revision=47242
2010-05-16 13:57:04 +00:00
Christoph von Wittich
f01aef274d [RBUILD]
close <Project> tag in generated vcxproj files
(VS2010 support still incomplete)
See issue #5199 for more details.

svn path=/trunk/; revision=47241
2010-05-16 13:33:52 +00:00
Daniel Reimer
110f06f6c0 Update:
DosBox to 0.74, Mirror of FireFox 2, IrfanView to 4.27, RosBE to 1.5.1, uTorrent to 2.0.2.

svn path=/trunk/; revision=47240
2010-05-16 12:44:22 +00:00
Amine Khaldi
615d59ca2e [PSDK]
- batclass.h : Introduce pragma once, apply a consistent formatting, apply appropriate conditionals, add some missing definitions and group related ones.
- winnt.h : Update JOBOBJECTINFOCLASS, BATTERY_REPORTING_SCALE and POWER_INFORMATION_LEVEL, introduce _ANONYMOUS_UNION in SYSTEM_LOGICAL_PROCESSOR_INFORMATION, and apply a consistent formatting for the rest.

svn path=/branches/header-work/; revision=47239
2010-05-16 12:23:45 +00:00
Giannis Adamopoulos
2dde7c6713 [user32]
-CreateWindow should fail when called with WS_EX_MDICHILD and the specified parent is not an mdiclient

svn path=/trunk/; revision=47238
2010-05-16 09:32:51 +00:00
Giannis Adamopoulos
089c4ecbb9 [win32]
-Call HCBT_CREATEWND, WM_NCCREATE and WM_CREATE with correct style and position
-Fixes some user32:win tests

svn path=/trunk/; revision=47237
2010-05-16 09:26:35 +00:00
Giannis Adamopoulos
250427a4d1 [user32_winetest]
-deactivate a test that hangs

svn path=/trunk/; revision=47236
2010-05-16 08:09:19 +00:00
Giannis Adamopoulos
9271a5bcb0 [kernel32]
-OpenConsoleW: Don't crash when wsName is null

svn path=/trunk/; revision=47235
2010-05-16 07:03:03 +00:00
Cameron Gutman
5ea607ab59 [AFD]
- Fix a typo in r47156
- Fixes Firefox regression (bug 5384)
- Thanks to mjmartin for testing

svn path=/trunk/; revision=47234
2010-05-16 05:22:51 +00:00
Michael Martin
5ab3830ab5 [regedit]
- Implement RegFindRecurse, RegFindWalk and helpers to find registry keys. Remove RegNextKey as its no longer used. Other misc fixes. Fixes searching in regedit. Patch by Katayama_Hirofumi.

svn path=/trunk/; revision=47233
2010-05-16 04:57:24 +00:00
Timo Kreuzer
fa5c83b451 [KERNEL32]
- SwitchToFiber: instead of doing a ret to the return address on the stack (which wouldn't work for a newly created fiber) store the returnaddress in the Eip field old fiber context and do a jmp to the Eip of the new fiber.
- BasepInitializeContext: set the Eip member of the Context to BaseFiberStartup for fibers
CreateFiberEx: initialize the fiber context, instead of an unused context on the stack.
- BaseFiberStartup: Use GetCurrentFiber, not GetFiberData to get the current fiber.
Fixes kernel32_wintest fiber

svn path=/trunk/; revision=47232
2010-05-16 00:30:11 +00:00
Timo Kreuzer
de96a18171 [NDK]
Add FIBER_CONTEXT_EIP constant

svn path=/trunk/; revision=47231
2010-05-16 00:24:07 +00:00
Amine Khaldi
077ed6cb51 [PSDK]
- Bring back TOKEN_STATISTICS alignment inclusions.

svn path=/branches/header-work/; revision=47230
2010-05-15 22:50:07 +00:00
Sylvain Petreolle
b9c51834ec Remove incorrect reference to winsock.h.
svn path=/trunk/; revision=47229
2010-05-15 22:44:31 +00:00
Christoph von Wittich
5e38f41aae [RBUILD]
delete outdated codeblocks backend (codeblocks does not support all features needed to build ros)

See issue #5381 for more details.

svn path=/trunk/; revision=47227
2010-05-15 20:37:24 +00:00
Michael Martin
9e2710ab67 [win32k]
- Change the first parameter type from HWND to PWINDOW_OBJECT for IntKillTimer as it makes more sense.
Activate IntSetTimer, already done by James.
- Add flag TMRF_DELETEPENDING. Destroy timers when this flag is set in ProcessTimers to allow any timers that have expired to have the WM_SYSTIMER/WM_TIMER messages posted to message queue before being destroyed.
- Fix error in FindTimer, it was always returning a Timer and it needed to return NULL if the specified timer did not exist.
- Fix error in PostTimerMessages, need to handle cases where the Window object is NULL which occurs when requesting messages for any window belonging to the thread. 
- In co_IntPeekMessage, simply call PostTimerMessages to have WM_SYSTIMER/WM_TIMER messages posted for expired timers. Remove call to old timer message handling.
- TODO: Code using the old timer implementation needs removed.
- Fixes bugs #2393, #3634, #2835. Commit dedicated to JT and Mr. Roboto.

svn path=/trunk/; revision=47226
2010-05-15 19:40:33 +00:00
Johannes Anderwald
0e5b61c534 [SYSAUDIO]
- Don't build the pin descriptor as this will make problems with dynamic audio devices which dynamically adjust their audio pins
- Remove dead code

svn path=/trunk/; revision=47225
2010-05-15 19:05:58 +00:00
Michael Martin
33284498ec [win32k]
- The description and changes made regarding WM_ACTIVATEAPP messages in r47126 were partially incorrect, the code was mostly correct.



svn path=/trunk/; revision=47224
2010-05-15 18:30:05 +00:00
Johannes Anderwald
425201146c [PORTCLS]
- Disable debugging

svn path=/trunk/; revision=47223
2010-05-15 17:57:09 +00:00
Johannes Anderwald
94c135b485 [PORTCLS]
- Pass subdevice interface to PcNewRegistryKey
- Fix multiple bugs in PcNewRegistryKey such as
- If key type is GeneralRegistryKey, the function is supposed to create a new key
- If key type is HwProfileRegistryKey, the type must be or'd with PLUGPLAY_REGKEY_DEVICE
- Implement opening keys of type DeviceInterfaceRegistryKey
- Free key handle if there is not enough memory to create a registry key object
- Add more comments

svn path=/trunk/; revision=47222
2010-05-15 17:17:05 +00:00
Amine Khaldi
fc4066c4cc [PSDK]
- ntsecpkg.h : merge recent changes from trunk.
- winnt.h : Add missing PROCESSOR_NUMBER, introduce _ANONYMOUS_UNION in NT_TIB{32,64}, update WELL_KNOWN_SID_TYPE & SID_NAME_USE, ULONG -> DWORD in LDT_ENTRY and TOKEN_GROUPS_AND_PRIVILEGES and a consistent formatting for the rest.
[FREELDR]
- setupldr.rbuild : merge recent changes from trunk.

svn path=/branches/header-work/; revision=47221
2010-05-15 16:53:39 +00:00
Eric Kohl
e5b5b48170 [WINLOGON]
- Add a hack to fix the APPDATA environment variable. This hack will be removed after bug #5372 has been fixed. Fixes bug #4102.

svn path=/trunk/; revision=47220
2010-05-15 16:02:14 +00:00
Jérôme Gardou
31dfebe9a7 Revert part of 47209. Hope this time is the good one
svn path=/trunk/; revision=47218
2010-05-15 09:59:42 +00:00
Cameron Gutman
ad9cb3cc34 [NTOSKRNL]
- Fix a bug that broke /NODEBUG and /CRASHDEBUG

svn path=/trunk/; revision=47216
2010-05-15 03:21:54 +00:00
Timo Kreuzer
d3f8544eca [NTOSKRNL]
Fix paramter parsing in KdbpGetCommandLineSettings. Fixes KDSERIAL

svn path=/trunk/; revision=47215
2010-05-15 03:02:10 +00:00
Timo Kreuzer
8653f56515 [OLEAUT32_WINETEST]
Skip crashing tests test_apm and test_enhmetafile

See issue #5396 for more details.

svn path=/trunk/; revision=47214
2010-05-15 01:30:24 +00:00
Timo Kreuzer
1e9beb6809 [WIN32CSR]
Fix display of harderror message box for STATUS_UNHANDLED_EXCEPTION

svn path=/trunk/; revision=47213
2010-05-15 01:05:09 +00:00
Timo Kreuzer
e093be6897 [GDIPLUS_WINETEST]
Comment out GdipDisposeImage in 3 places, where it was crashing

See issue #5395 for more details.

svn path=/trunk/; revision=47212
2010-05-15 00:12:14 +00:00
Jérôme Gardou
9993f9c793 [ROSTESTS]
- something went wrong with previous commit...


svn path=/trunk/; revision=47211
2010-05-14 23:21:04 +00:00
Jérôme Gardou
e23160a43c [ROSTESTS]
- more tests for direct DC creation/deletion

svn path=/trunk/; revision=47210
2010-05-14 23:19:16 +00:00
Timo Kreuzer
88e3cf6fbe [GDI32_WINETEST]
Skip test in gdi32_winetest metafile, that crashes

See issue #5392 for more details.

svn path=/trunk/; revision=47209
2010-05-14 23:13:13 +00:00
Gregor Schneider
9863fd3445 [NEWINFLIB] Fix an off-by-one bug, which lead to the crash of mkhive after parsing ~3 files on Windows or ~5 files on Linux
See issue #5338 for more details.

svn path=/trunk/; revision=47208
2010-05-14 21:20:40 +00:00
Gregor Schneider
c7721ce942 [MKHIVE]
- Active the planned cleanup function to motivate people to actually free resources: mkhive currently leaks ~500kb of memory after a usual run
- Improve debug print

svn path=/trunk/; revision=47207
2010-05-14 21:13:33 +00:00
Gregor Schneider
d28f0be86e [INFLIBNEW] Free allocated memory on error
svn path=/trunk/; revision=47206
2010-05-14 20:56:43 +00:00
Amine Khaldi
eeb2e93d2d [ARMDDK]
- We don't really need ExiTryToAcquireFastMutex declaration here.
[HAL]
- Fix export for ExTryToAcquireFastMutex. On x86 builds it should forward to ntoskrnl's ExiTryToAcquireFastMutex, arm has it's own implementation. Patch by Timo.

svn path=/branches/header-work/; revision=47204
2010-05-14 20:15:25 +00:00
Amine Khaldi
0756bc5fd0 [FREELDR]
- freeldr.rbuild : Apply a consistent formatting.
- Add the missing AcpiPresent variable to macharm.c
- Exclude a couple of code paths when building for ARM.
[ARMDDK]
- Add missing ExiTryToAcquireFastMutex declaration.

svn path=/branches/header-work/; revision=47202
2010-05-14 18:49:42 +00:00
Amine Khaldi
5b939ffc3c [NTOSKRNL]
- Fix ExInterlockedPopEntryList and ExInterlockedPushEntryList, they were not working at all. Brought to you by Timo ;)

svn path=/branches/header-work/; revision=47201
2010-05-14 18:40:23 +00:00
Gregor Schneider
12eb6e6cba [MKHIVE] Check parameters before accessing them, update usage information
svn path=/trunk/; revision=47200
2010-05-14 17:46:14 +00:00
Eric Kohl
449bd3cb85 [MSGINA]
- Fix the order of controls to match the expected tab order. This makes the focus stop jumping around like crazy when you press the Tab key.

svn path=/trunk/; revision=47199
2010-05-14 17:12:35 +00:00
Eric Kohl
029c6e67a9 [WINLOGON]
- Store all environment variables that were passed from msgina.dll in the volatile environment key.
- Add the APPDATA environment variable to the volatile environment. Unfortunately SHGetFolderPath does not seem to expand the appdata path. Bug or Feature??
- Create the environment block for the shell process after the volatile environment key has been filled, so its variables are included.
- Yet another step to fixing bug #4102.

svn path=/trunk/; revision=47198
2010-05-14 17:08:20 +00:00
Johannes Anderwald
0801068a35 [PORTCLS]
- Don't request initializing delayed service request as this is the task of the miniport driver
- Reimplement the service group object:
- Use the initialized timer object when RequestService is called
- Fix possible race conditions when adding / removing a service sink by protecting it with a lock
- Acquire the service group list lock when executing the shared dpc routine

svn path=/trunk/; revision=47197
2010-05-14 15:47:00 +00:00
Amine Khaldi
d052e38953 [INTRIN_ARM]
- Implement __yield and __break arm intrinsics.
[DDK]
- Relax INTERLOCKED_RESULT conditional definition.
[PSDK]
- Fix some nasty structure misalignments.
- Fix YieldProcessor definition for ARM.
[ARMDDK]
- Add several missing definitions.

svn path=/branches/header-work/; revision=47196
2010-05-14 11:45:14 +00:00
Cameron Gutman
ebb491824a [IPHLPAPI]
- Implement GetAdaptersAddresses
- Fixes the last iphlpapi winetest

svn path=/trunk/; revision=47195
2010-05-14 01:30:37 +00:00
Eric Kohl
0ca885a586 [USERENV]
CreateEnvironmentBlock: Also add the volatile environment values to the users environment block.

svn path=/trunk/; revision=47194
2010-05-13 20:38:16 +00:00
Sir Richard
df33b38ed0 [NTOS]: Fix definition of unused MI_MAKE_SOFTWARE_PTE macro.
[NTOS]: Correctly setup the PFN entries for freshly allocated paged pool pages. Fixes a problem where the page could've still had stale/garbage data.
[NTOS]: Add some extra assertions in the code to catch memory corruption and detect invalid logic.
[NTOS]: Fix some typos in the code (comments/whitespace).
[NTOS]: Make the dreaded page fault message that breaks paged pool on some systems more verbose for future debugging.

svn path=/trunk/; revision=47189
2010-05-12 22:47:46 +00:00
Eric Kohl
931fc122a0 [MSGINA]
Use WLX_PROFILE_V2_0 instead of WLX_PROFILE_V1_0 and create an environment string that is filled with a single environment variable. WIP for bug #4102.

svn path=/trunk/; revision=47187
2010-05-12 22:10:07 +00:00
Sir Richard
3a80da9a3e [NTOS]: When grabbing physically contigous pages from the zero or free list, make sure to re-initialize their PFN entries correctly, since their data might be stale. Fixes potential weird memory corruption bugs.
[NTOS]: Physically contiguous memory allocations are not guaranteed to be zeroed, so do not zero the pages.
[NTOS]: When allocating contigous memory, mark the PFN entries appropriately after mapping the I/O ranges.
[NTOS]: When freeing contiguous memory, assert that all the freed pages correspond to PFN entries that we expect to have allocated for this purpose. Detects (not neccessarily fixes) memory corruption issues in contiguous memory allocations.
[NTOS]: These changes mostly affect certain network card and sound card systems/real hardware, they fix possible bugs and detect corruption that was otherwise going by unnoticed.

svn path=/trunk/; revision=47186
2010-05-12 21:37:19 +00:00
Gregor Schneider
b320b4bcb1 [SHELL32] Amendment to r47182: GetAsyncKeyState -> GetKeyState (thanks to Giannis), simplify
svn path=/trunk/; revision=47185
2010-05-12 21:11:24 +00:00
Sir Richard
547dbfc5cf [NTOS]: Move MiFindContiguousPages to ARM3/contmem.c since I don't know what it was doing in freelist.c. No code change.
svn path=/trunk/; revision=47184
2010-05-12 20:57:21 +00:00
Sir Richard
11453cf565 [NTOS]: Add assertions to the paged pool and demand zero page faults, to catch possible errors and corruptions. These paths are not yet taken in today's builds, so they do not affect any runtime code.
[NTOS]: Add assertions regarding the portability of certain code, which will need changes on ARM/x64. These should probably be C_ASSERT's but I don't want to break Timo's build.
[NTOS]: Define MM_NOIRQL (found in assertions) instead of magical -1.
[NTOS]: Add MI_IS_SESSION_PTE macro.
[NTOS]: Export the MiXxxPte variables.
[NTOS]: Fix some typos in comments.


svn path=/trunk/; revision=47183
2010-05-12 20:48:15 +00:00
Gregor Schneider
77bbb3cacb [SHELL32] Add initial ctrl+c/v handling (WIP for bug #4850)
svn path=/trunk/; revision=47182
2010-05-12 20:41:55 +00:00
Gregor Schneider
0c0d737b5d [SHELL32] Remove misplaced function header
svn path=/trunk/; revision=47181
2010-05-12 20:37:48 +00:00
Gregor Schneider
7b762e3b4e [SHELL32] Improve debug print by printing text
svn path=/trunk/; revision=47180
2010-05-12 19:54:02 +00:00
Gregor Schneider
0b2f076246 [USRMGR]
- Fix the friends of the bug of the month

svn path=/trunk/; revision=47179
2010-05-12 19:19:44 +00:00
Sir Richard
47b27e38f3 [NTOS]: Fix MiInsertPageInFreeList, it was using the ARM3 PFN Database macro, even though we are still using the Mm PFN Database. Also, it was lacking the code to notify the zero-page thread, and to increase available pages.
svn path=/trunk/; revision=47178
2010-05-12 19:11:49 +00:00
Eric Kohl
6899eeb7b6 [WINLOGON]
Fixed bug of the month. I'm surprised that winlogon worked at all.

svn path=/trunk/; revision=47177
2010-05-12 19:10:04 +00:00
Amine Khaldi
b596fbada4 [XDK]
- Add RESULT_ZERO, RESULT_NEGATIVE and RESULT_POSITIVE definitions for other architectures than X86
[DDK]
- Update ntddk.h to reflect XDK changes.

svn path=/branches/header-work/; revision=47176
2010-05-12 18:43:23 +00:00
Sir Richard
291fb765f3 [NTOS]: Fix 4MB assumptions and use PDE_MAPPED_VA instead, which accurately describes the address space mapped by a PDE (which is different on PAE, x64, ARM, etc).
svn path=/trunk/; revision=47175
2010-05-12 18:42:05 +00:00
Sir Richard
944fe46d70 [NTOS]: User pages are not used until Phase 1, they should not be setup in Phase 0. Fixes premature initalization.
svn path=/trunk/; revision=47174
2010-05-12 18:39:09 +00:00
Sir Richard
926bd0522f [NTOS]: Compute MiHighestUserPte, MiHighestUserPde, MiSessionImagePteStart, MiSessionImagePteEnd, MiSessionBasePte, MiSessionLastPte since these internal variables did not exit yet. Useful for debugging and also future PFN support. Just computes some values, no behavior changes.
svn path=/trunk/; revision=47173
2010-05-12 18:36:15 +00:00
Sir Richard
133872d3e7 [NTOS]: MmSystemPageDirectory is an array of page directories, not just a value. On x86 there's just one page directory, but that's not the case on other architectures/PAE, so fix this bug.
svn path=/trunk/; revision=47172
2010-05-12 18:33:18 +00:00
Amine Khaldi
1f071790b9 [KDCOM]
- Include ntifs.h instead of ntddk.h (and don't include both at the same time).

svn path=/branches/header-work/; revision=47171
2010-05-12 18:19:05 +00:00
Amine Khaldi
e360db369f [XDK]
- Remove RESULT_NEGATIVE, RESULT_ZERO and RESULT_POSITIVE from amd64/ke.h
- INTERLOCKED_RESULT isn't x86 only.
[DDK]
- Update wdm.h and ntddk.h to reflect the XDK changes.

svn path=/branches/header-work/; revision=47170
2010-05-12 13:02:44 +00:00
Aleksey Bragin
c6ddd201c7 [HALX86]
- Revert changes to HalpGetPCIData made in r47162. There is no need to introduce ReactOS-specific behavior of this function. It's much better to aim real NT compatibility, and develop your drivers against NT first and only then hack ReactOS.
- Changes to buses scanning are left as they are.

svn path=/trunk/; revision=47169
2010-05-12 09:45:43 +00:00
Aleksey Bragin
cdf0478255 [USBDRIVER]
- Implement deregistering HCD in a device manager. Now, the HCI which failed to initialize will be properly freed without calling NULL pointer or crashing with freed memory access.
See issue #4813 for more details.

svn path=/trunk/; revision=47168
2010-05-12 09:42:07 +00:00
Aleksey Bragin
e4dec4c4cb - Revert 47139 by cgutman: Don't try to be smarter than usbdriver's author. He especially put registering HCD interface before so that any error handling function would work correctly and free up allocated resources. Fixes one crash in VMWare. A proper solution for the problem which 47139 tried to "fix" will be committed next.
svn path=/trunk/; revision=47167
2010-05-12 09:34:36 +00:00
Jeffrey Morlan
cdc3b26818 commit file missing from r47165
svn path=/trunk/; revision=47166
2010-05-12 04:01:16 +00:00
Jeffrey Morlan
630ecdce7c [KERNEL32] [WIN32CSR] Implement SetConsoleScreenBufferSize. FAR Manager now works again.
svn path=/trunk/; revision=47165
2010-05-12 03:34:02 +00:00
Timo Kreuzer
acb61e7d31 [FREELDR] Fix uninitialized variable warning. (Does anyone know why the warning isn't treated as an error?)
[SETUPLDR] Use mini_hal only on i386 builds

svn path=/trunk/; revision=47164
2010-05-12 03:29:08 +00:00
Jeffrey Morlan
3ffc64878c [WIN32CSR] Get rid of dynamic "LineBuffer": it wasn't being resized properly in all cases, causing corruption of Win32CsrApiHeap. Replaced with fixed buffer (painting a line with multiple TextOutW calls if necessary).
svn path=/trunk/; revision=47163
2010-05-12 03:03:12 +00:00
Cameron Gutman
0a6ca40598 [HAL]
- Return the correct value if the PCI slot number is invalid
- Use the bus number from the PCI BIOS instead of doing a manual probe if we can because it is much more accurate (our probing code doesn't detect buses without devices present)
- Don't probe for devices at invalid locations on PCI type 2 buses
- Check for a valid bus number so we don't return the wrong value

svn path=/trunk/; revision=47162
2010-05-12 02:34:04 +00:00
Sir Richard
c5e12bcf40 [NTOS]: We might get page faults before memory areas are setup, since so much ARM3 work now gets done before the memory areas are ready to go. Since obviously these faults cannot be caused by non-ARM3 Mm, we assume them to be ARM3 faults (as long as they happened in KSEG0_BASE). Fixes a bug where early page faults in ARM3 PTEs would get treated as non-ARM3 faults and fail.
svn path=/trunk/; revision=47161
2010-05-12 00:40:23 +00:00
Sir Richard
f61cf60f1b [NTOS]: HEADERS: Add PDE_TOP. It is defined for IA64/AMD64 but not for i386 (in the public headers). Add a note that these addresses are bogus on PAE systems.
svn path=/trunk/; revision=47160
2010-05-12 00:38:46 +00:00
Sir Richard
b5a09b26c2 [NTOS]: Restore previous correct ASM behavior of checking for success codes, not only STATUS_SUCCESS, after a page fault. For example, a demand zero fault returns STATUS_PAGE_FAULT_DEMAND_ZERO upon success, and the new C code would treat it as a failure. Fixes a bug.
svn path=/trunk/; revision=47159
2010-05-12 00:36:52 +00:00
Amine Khaldi
cf73dc7621 - Sync with trunk up to r46941.
[VMWINST]
- Rename FileExists() to DoesFileExist() to avoid clashing with the real API.

svn path=/branches/header-work/; revision=47155
2010-05-10 19:04:41 +00:00
Amine Khaldi
f14be1ee47 [PSDK]
- Fix PREVENT_MEDIA_REMOVAL redefinition.
- Add some missing winnt.h and winuser.h definitions.
[NDK]
- Remove some redundant definitions (that now exist in winnt.h)
[KERNEL32]
- Remove a useless undef (although the hack above it still remains for now)
[ADVAPI32]
- Fix some TraceMessage params types.

svn path=/branches/header-work/; revision=47153
2010-05-09 22:53:41 +00:00
Amine Khaldi
cd5c660bf9 Revert the sync.
We only can safely sync up to r46941.

svn path=/branches/header-work/; revision=47096
2010-05-03 16:42:07 +00:00
Amine Khaldi
69b36d050f Sync with trunk head (part 1 of 2)
svn path=/branches/header-work/; revision=47094
2010-05-03 12:54:59 +00:00
Amine Khaldi
daef20d74b - DriverEntry is ULONG.
svn path=/branches/header-work/; revision=47092
2010-05-03 11:22:34 +00:00
Sylvain Petreolle
f2f1c844d9 Fix merge artifact.
svn path=/branches/aicom-network-branch/; revision=47086
2010-05-02 19:25:50 +00:00
Amine Khaldi
f98870a07c [XDK]
- Apply _ANONYMOUS_UNION/_ANONYMOUS_STRUCT where it's missing, and get rid of __GNU_EXTENSION.
- Some minor formatting consistencies.
[DDK]
- Update wdm.h, ntifs.h and ntddk.h to reflect the recent XDK changes.

svn path=/branches/header-work/; revision=47000
2010-04-23 10:50:19 +00:00
Amine Khaldi
dde9ac5d8a [DDK]
- miniport.h : Remove VIDEO_ACCESS_RANGE definition.
- ntagp.h : Introduce pragma once, apply a consistent formatting and add some missing definitions.
- video.h : Introduce pragma once, apply a consistent formatting, remove _WINDDI_ guard, group related definitions and add some missing ones.
- videoagp.h : Introduce pragma once and apply a consistent formatting.

svn path=/branches/header-work/; revision=46973
2010-04-21 01:33:08 +00:00
Amine Khaldi
8bb6364e53 [DDK]
- Move nettypes.h to PSDK, introduce pragma once and apply a consistent formatting.
- Remove newdev.h from DDK (it's already in PSDK).
- ndisguid.h and ndiswan.h : Introduce pragma once, apply a consistent formatting and add some missing definitions.
- netpnp.h : Introduce pragma once, apply a consistent formatting and mark NDIS_DEVICE_PNP_EVENT with a FIXME indicating that it belongs to ndis.h
[PSDK]
- newdev.h : Introduce pragma once, apply a consistent formatting, add missing setupapi.h inclusion along with some missing definitions and guard them with the appropriate WINVER.

svn path=/branches/header-work/; revision=46944
2010-04-19 16:18:04 +00:00
Amine Khaldi
1feb14570e [DDK]
- mountdev.h : Guards definition with the appropriate NTDDI_VERSION, and apply a consistent formatting.
- mountmgr.h : Guards definition with the appropriate NTDDI_VERSION, apply a consistent formatting and add some missing definitions.

svn path=/branches/header-work/; revision=46936
2010-04-19 10:31:22 +00:00
Amine Khaldi
701e3bf14a [DDK]
- Move ntddchgr.h and ntddstor.h to PSDK, apply a consistent formatting, group related definitions, add some missing definitions and improve several existing ones.
- scsi.h : Add missing srb.h inclusion, group related definitions, apply a consistent formatting, add several missing definitions and improve a couple of existing ones.
- srb.h : Group related definitions, apply a consistent formatting, add several missing definitions and improve some existing ones.

svn path=/branches/header-work/; revision=46901
2010-04-16 21:43:38 +00:00
Amine Khaldi
c7a0a39963 [DDK]
- Move lmon.h to PSDK and apply a consistent formatting.

svn path=/branches/header-work/; revision=46896
2010-04-16 13:42:34 +00:00
Amine Khaldi
b9fa9ff882 [DDK]
- Move ksuuids.h to PSDK, apply a consistent formatting, add some missing definitions and guard some with the appropriate NTDDI_VERSION.

svn path=/branches/header-work/; revision=46895
2010-04-16 13:38:34 +00:00
Amine Khaldi
bed405a92a [DDK]
- Move ksdebug.h to PSDK, apply a consistent formatting, add missing evntrace.h inclusion and improve a couple of definitions.
[PSDK]
evntrace.h : Introduce pragma once, apply a consistent formatting and add several missing definitions.

svn path=/branches/header-work/; revision=46894
2010-04-16 13:19:55 +00:00
Amine Khaldi
2b0248408a [DDK]
- Move kcom.h to PSDK and apply a consistent formatting.

svn path=/branches/header-work/; revision=46890
2010-04-15 22:28:50 +00:00
Amine Khaldi
3ba7cea0e7 [DDK]
- d4drvif.h : Introduce pragma once, apply a consistent formatting, group related definitions and add several missing ones.
- d4iface.h : Introduce pragma once, apply a consistent formatting and group related definitions.
- dderror.h : Introduce pragma once and apply a consistent formatting.
- dxapi.h : Apply consistent formatting.
- fltsafe.h : Guard FLOATSAFE inside the proper NTDDI_VERSION and apply a consistent formatting.
- kbdmou.h : Introduce pragma once, apply a consistent formatting and add a missing wmidata.h inclusion.
- ntddmou.h : Move to PSDK, introduce pragma once, apply a consistent formatting and add several missing definitions.
[PSDK]
- ntddkbd.h : Introduce pragma once, apply a consistent formatting and add several missing definitions.

svn path=/branches/header-work/; revision=46889
2010-04-15 21:56:39 +00:00
Amine Khaldi
3e032a1c42 [DDK]
- Add missing wmidata.h definitions.

svn path=/branches/header-work/; revision=46888
2010-04-15 21:40:44 +00:00
Timo Kreuzer
0e2cdc86f2 [NDIS]
Fix build

svn path=/branches/header-work/; revision=46869
2010-04-14 19:01:16 +00:00
Amine Khaldi
1698f62b8d [DDK]
ndis.h : Group related definitions, add missing PROTOCOL_RESERVED_SIZE_IN_PACKET, NdisGetFirstBufferFromPacketSafe, NdisSetPacketPoolProtocolId and use _ANONYMOUS_UNION/_ANONYMOUS_STRUCT.

svn path=/branches/header-work/; revision=46866
2010-04-14 13:40:55 +00:00
Amine Khaldi
7927a9d7b6 [DDK]
scsi.h : Add missing READ_TOC formats definitions.

svn path=/branches/header-work/; revision=46865
2010-04-14 12:02:41 +00:00
Timo Kreuzer
3e3a1652c1 [XDK]
- Move WDM version defines to wdm.template.h
- Move USE_DMA_MACROS / NO_LEGACY_DRIVERS to wdm.template.h, remove duplicate

svn path=/branches/header-work/; revision=46810
2010-04-10 11:32:36 +00:00
Amine Khaldi
f0e3db2b34 [DDK]
- atm.h : Introduce pragma once, apply consistent formatting and add some missing definitions.

svn path=/branches/header-work/; revision=46799
2010-04-09 21:41:00 +00:00
Amine Khaldi
3d615f92df - Fix WmiFireEvent Guid type.
- Define WINSOCK_API_LINKAGE in ws2_32
- Remove winsock.h inclusion from ws2_32/misc/async.c

svn path=/branches/header-work/; revision=46793
2010-04-09 15:35:53 +00:00
Timo Kreuzer
b1675d448b [RPCRT4]
Remove some definitions from unix_func.h, as we have them in our public headers now. This file is not wine synced.

svn path=/branches/header-work/; revision=46790
2010-04-09 13:06:30 +00:00
Timo Kreuzer
8a7d6a9a0f Don't define u_int64 in wine/dcetypes.idl
svn path=/branches/header-work/; revision=46789
2010-04-09 13:05:00 +00:00
Amine Khaldi
4e795c1f4c - Fix netstat build.
- Improve WSPSelect declarations in msafd.
- Include the correct wmilib header in wmi.
- Remove a commented out inclusion in ws2san.h

svn path=/branches/header-work/; revision=46763
2010-04-07 15:16:21 +00:00
Amine Khaldi
15ca120bcc - Move winsplp.h to PSDK and improve it.
- wspiapi.h : __inline -> FORCEINLINE, alter _WSPIAPI_STRNCPY_S and _WSPIAPI_SPRINTF_S_1
- winspool.h : Add missing PRINTER_NOTIFY_OPTIONS(_TYPE)
- ws2spi.h and also compstui.h : Group some related definitions.
- Add wine/ddk/winsplp.h and winddiui.h wrappers around our files, as wine code wants them in ddk.

svn path=/branches/header-work/; revision=46757
2010-04-07 00:02:57 +00:00
Timo Kreuzer
22d1e6dc9e [LIBXML2]
revert last changes to 3rd party code and hack the config  file a bit more instead.

svn path=/branches/header-work/; revision=46746
2010-04-06 12:04:47 +00:00
Timo Kreuzer
195d698a9d [LIBXML2]
Don't define _WINSOCKAPI_

svn path=/branches/header-work/; revision=46745
2010-04-06 11:44:35 +00:00
Timo Kreuzer
24fc3ac27d Remove svn:mergeinfo property from several files
svn path=/branches/header-work/; revision=46694
2010-04-03 08:03:17 +00:00
Amine Khaldi
85da9e3592 Forgot this one.
svn path=/branches/header-work/; revision=46678
2010-04-02 11:44:39 +00:00
Amine Khaldi
1a094fe2b7 [PSDK]
- Fix a couple of macro names.

svn path=/branches/header-work/; revision=46676
2010-04-02 11:32:01 +00:00
Timo Kreuzer
6c59bab9ba fix macro name in iptypes.h
svn path=/branches/header-work/; revision=46675
2010-04-02 11:25:29 +00:00
Amine Khaldi
f14dc8bd4e [PSDK]
- winddiui.h : Fix compstui.h inclusion.

svn path=/branches/header-work/; revision=46674
2010-04-02 11:03:53 +00:00
Amine Khaldi
e33f57dc6a [DDK]
- Move winddi.h and winddiui.h to PSDK.

svn path=/branches/header-work/; revision=46673
2010-04-02 11:00:45 +00:00
Amine Khaldi
350280885d [PSDK]
- winsock.h : Fix a typo, and remove some duplicate definitions.

svn path=/branches/header-work/; revision=46672
2010-04-02 10:59:35 +00:00
Timo Kreuzer
c3f04c87e0 - fix _EXTPUSH (DUMMYUNIONNAME was used twice, like in the broken ms headers)
- add wine/ddk/compstui.h wrapper around our file, as wine code wants it in ddk

svn path=/branches/header-work/; revision=46671
2010-04-02 10:45:00 +00:00
Timo Kreuzer
d12179e0ef fix mingw.rbuild
svn path=/branches/header-work/; revision=46670
2010-04-02 10:19:13 +00:00
Timo Kreuzer
9f70bfed41 fix rbuild file
svn path=/branches/header-work/; revision=46669
2010-04-02 10:18:35 +00:00
Amine Khaldi
e06395dacf Sync with trunk head (part 1 or 2)
svn path=/branches/header-work/; revision=46667
2010-04-02 10:03:25 +00:00
Amine Khaldi
e998dec477 [PSDK]
- Add missing mstcpip.h, wsipv6ok.h and wspiapi.h definitions.

svn path=/branches/header-work/; revision=46666
2010-04-02 09:14:55 +00:00
Amine Khaldi
ea7077c9db [BATTC]
- Correct the inclusion of wmilib
[PSDK]
- ws2tcpip.h improvements, some formatting fixes, remove some duplicate definitions between winsock2.h and ws2def.h
[XDK]
- Move some definitions from ntifs.template.h to more appropriate places.
[NTIFS]
- Reflect XDK changes.

svn path=/branches/header-work/; revision=46608
2010-03-30 21:50:05 +00:00
Amine Khaldi
05b6c7f4c9 [PSDK]
- Improve ws2spi.h

svn path=/branches/header-work/; revision=46596
2010-03-30 13:24:23 +00:00
Amine Khaldi
e6d8f850c7 [PSDK]
- Add missing ws2ipdef.h definitions.
- Group related definitions.

svn path=/branches/header-work/; revision=46591
2010-03-30 10:39:52 +00:00
Amine Khaldi
106198108d [PSDK]
- ws2bth.h and ws2def.h : Introduce pragma once and add several missing definitions.
[DDK]
- Improve csq.h

svn path=/branches/header-work/; revision=46590
2010-03-30 09:52:11 +00:00
Timo Kreuzer
ad81859d64 Simplify definition of PIMAGE_NT_HEADERS
svn path=/branches/header-work/; revision=46581
2010-03-30 05:22:15 +00:00
Amine Khaldi
f7e10df004 [PSDK]
inaddr.h : Fix formatting.
qos.h : Introduce pragma once along with several missing definitions.
winsock(2).h : Introduce pragma once, apply consistent formatting, add so many missing definitions and remove several unrelated ones.

svn path=/branches/header-work/; revision=46577
2010-03-29 23:58:01 +00:00
Amine Khaldi
fd317aa03e [PSDK]
- Add several missing mswsockdef.h definitions.
- mswsock.h : Introduce pragma once, apply consistent formatting, improve several existing definitions, remove some unrelated ones and add several missing ones.

svn path=/branches/header-work/; revision=46501
2010-03-27 22:06:39 +00:00
Amine Khaldi
025ff7f69d [DDK]
ws2san.h :
- Introduce pragma once.
- Apply consistent formatting.
- Improve several existing definitions.
- Add several missing ones.

svn path=/branches/header-work/; revision=46496
2010-03-27 21:27:37 +00:00
Amine Khaldi
736107dd68 [XDK]
- Autogenerate ntifs.h based on ntifs.template.h
- Remove some duplicate definitions between WDM and NTDDK.

[DDK]
- Remove wmlib.h
- Reflect the recent XDK changes.

svn path=/branches/header-work/; revision=46490
2010-03-27 15:31:25 +00:00
Timo Kreuzer
87ac6e3504 More formatting fixe
svn path=/branches/header-work/; revision=46487
2010-03-27 10:45:04 +00:00
Timo Kreuzer
53972f4c24 Formatting fix
svn path=/branches/header-work/; revision=46486
2010-03-27 10:34:55 +00:00
Amine Khaldi
636b46506f [DDK]
- Move devioctl.h to PSDK, introduce pragma once, apply consistent formatting and add several missing definitions.
[XDK]
- Autogenerate devioctl.h based on devioctl.template.h

svn path=/branches/header-work/; revision=46482
2010-03-27 01:12:23 +00:00
Amine Khaldi
dbe15d6293 [DDK]
dciddi.h :
- Introduce pragma once, apply consistent formatting, add missing definitions and improve several existing ones.

svn path=/branches/header-work/; revision=46481
2010-03-27 00:32:37 +00:00
Amine Khaldi
aa5f7dabb5 [DDK]
- Move compstui.h to PSDK, introduce pragma once, apply consistent formatting, add missing definitions and improve several existing ones.

svn path=/branches/header-work/; revision=46480
2010-03-27 00:08:19 +00:00
Cameron Gutman
22e3000143 - Fix comments related to r45531
svn path=/branches/aicom-network-branch/; revision=45545
2010-02-10 00:53:03 +00:00
Cameron Gutman
e4a060ead4 - Merge from trunk up to r45543
svn path=/branches/aicom-network-branch/; revision=45544
2010-02-10 00:42:46 +00:00
Cameron Gutman
2597cfe258 - Fix the LARGE_SIZE constant so it uses the lookaside list for mbuf ext buffers allocations again
- We added one byte to each ext buffer as a ref count for oskit_buffer_* functions so we need to compensate for that by adding one byte to the LARGE_SIZE constant
 - This should boost performance too because we allocate one ext buffer for each incoming and outgoing TCP packet

svn path=/branches/aicom-network-branch/; revision=45531
2010-02-09 17:58:11 +00:00
Cameron Gutman
9e677d15e1 - Forgot this file (sorry)
- mswsock.dll compiles and links now :)

svn path=/branches/aicom-network-branch/; revision=45461
2010-02-06 14:29:09 +00:00
Cameron Gutman
f57e5b6562 - Build fixes
- For some reason when I applied the patch from my other WC to this one, I ended up with 2-3 copies of the same code in each file

svn path=/branches/aicom-network-branch/; revision=45460
2010-02-06 14:24:55 +00:00
Cameron Gutman
9b6310f09a - Forgot this file
svn path=/branches/aicom-network-branch/; revision=45454
2010-02-06 03:10:25 +00:00
Cameron Gutman
503fdfb059 - New winsock (part 6 of x)
- Remove old dnslib

svn path=/branches/aicom-network-branch/; revision=45453
2010-02-06 03:01:51 +00:00
Cameron Gutman
eb3569ff5b - New winsock (part 5 of x)
- Add winsock headers

svn path=/branches/aicom-network-branch/; revision=45452
2010-02-06 03:00:31 +00:00
Cameron Gutman
d5fa02d2c3 - New winsock (part 4 of x)
- Rename ws2_32_new to ws2_32

svn path=/branches/aicom-network-branch/; revision=45451
2010-02-06 02:58:47 +00:00
Cameron Gutman
f21110d99f - New winsock (part 3 of x)
- Implement DnsApiAlloc and DnsApiFree

svn path=/branches/aicom-network-branch/; revision=45450
2010-02-06 02:56:20 +00:00
Cameron Gutman
fd2b0ac47d - New winsock (part 2 of x)
- Replace the old mswsock with the new one

svn path=/branches/aicom-network-branch/; revision=45449
2010-02-06 02:40:26 +00:00
Cameron Gutman
ff2d0c4e3a - New winsock (part 1 of x)
- Remove the old ws2_32

svn path=/branches/aicom-network-branch/; revision=45448
2010-02-06 02:32:13 +00:00
Cameron Gutman
166bc10af9 - Fix some epic fail in NdisMRegisterMiniport
- We were checking to see if there were valid NDIS 5.1-specific characteristics if 5.1 was specified as the version but we didn't actually copy them into our local buffer
 - Now NdisCancelPackets will actually do something if the miniport implements a MiniportCancelSendPackets handler and PnP event notifications will get through to the miniport if it implements a MiniportPnPEventNotify handler

svn path=/branches/aicom-network-branch/; revision=45437
2010-02-05 08:33:48 +00:00
Cameron Gutman
fdd91bc7e8 [NDIS]
- Fix buffer length passed to KeRegisterBugCheckCallback

svn path=/branches/aicom-network-branch/; revision=45436
2010-02-05 07:35:04 +00:00
Cameron Gutman
833baf1715 [PSDK, MSAFD]
- Fix a typo
[NETSTAT]
 - Uncomment and fix displaying successful fragmentation data
 - Fix a typo


svn path=/branches/aicom-network-branch/; revision=45435
2010-02-05 07:16:50 +00:00
Cameron Gutman
bd7ffd61fd [AFD]
- Add more cases to TdiAddressSizeFromType
 - Return STATUS_INVALID_PARAMETER instead of bugchecking if somebody gives us a bad address type
 - Fixes Steam (confirmed by Geoz)
 - Will also be merged to trunk soon

svn path=/branches/aicom-network-branch/; revision=45400
2010-02-03 20:02:39 +00:00
Cameron Gutman
29589c0449 - Remove some unused junk code
svn path=/branches/aicom-network-branch/; revision=45349
2010-01-30 16:45:22 +00:00
Cameron Gutman
a0090f038d - ovbcopy is used when the source address and destination address overlap so defining it to memcpy was a horrible idea
svn path=/branches/aicom-network-branch/; revision=45347
2010-01-30 15:18:21 +00:00
Cameron Gutman
57b3f4582a - Fix a potential buffer overrun and null pointer dereference
svn path=/branches/aicom-network-branch/; revision=45284
2010-01-27 08:49:48 +00:00
Cameron Gutman
79c35d419a - Handle the case where a socket sends an event notification without being accepted first
svn path=/branches/aicom-network-branch/; revision=45283
2010-01-27 07:44:42 +00:00
Ged Murphy
707c9cbb55 Inform rbuild of the sdks. Building now gets much further
svn path=/branches/Tree-restructure-test/; revision=45262
2010-01-26 10:46:39 +00:00
Ged Murphy
3469fd2fdb Add the crt and psdk headers
svn path=/branches/Tree-restructure-test/; revision=45261
2010-01-26 10:42:19 +00:00
Ged Murphy
4f9fc0b494 Fix rbuild paths and try to improve the hardcoded mess by using the preprocessor instead
svn path=/branches/Tree-restructure-test/; revision=45258
2010-01-26 09:30:52 +00:00
Cameron Gutman
e2aa2958fa - Define OSKIT so we can use special oskit functions
- Implement oskit buffer functions to track references and allocate buffers
 - Remove unneeded mbuf freeing hacks now that we track references (fixes random crashes would occur when an mbuf was freed inside ip_output)
 - Remove the "ACK hack" that we used to hack around our loopback implementation
 - Remove unneeded mbuf pool initialization
 - Remove unused code in sleep.c

svn path=/branches/aicom-network-branch/; revision=45257
2010-01-26 04:20:06 +00:00
Timo Kreuzer
5e8349955b One rbuild file for libs is better than 2
svn path=/branches/Tree-restructure-test/; revision=45253
2010-01-25 16:53:56 +00:00
Timo Kreuzer
75d4c69a68 - delete old folders from main rbuild file, we don't need those anymore
- Add debugsup, mingw, wcsfuncs
- add sdk.rbuild
- comment our dependency on rtl in mkhive for now
- comment out buildno.h in the makefile
rbuild creates makefile.auto now

svn path=/branches/Tree-restructure-test/; revision=45252
2010-01-25 16:44:27 +00:00
Ged Murphy
a9d1023a27 - Add the syssetup.inf template
- Modify the syssetup rbuild path to suit
This path probably isn't ideal but it can be moved later when the tree starts to make more sense

svn path=/branches/Tree-restructure-test/; revision=45251
2010-01-25 15:43:48 +00:00
Ged Murphy
acf63ceaaf Add mkhive, rbuild now tries to parse the XML
svn path=/branches/Tree-restructure-test/; revision=45250
2010-01-25 15:39:00 +00:00
Ged Murphy
90af9edcbe Comment out all the old dirs from the rbuild file and add the new sdk dir
svn path=/branches/Tree-restructure-test/; revision=45249
2010-01-25 15:37:50 +00:00
Ged Murphy
ca5427d681 - Add zlib, inflib needs this
- Add an rbuild file for the libs dir

svn path=/branches/Tree-restructure-test/; revision=45248
2010-01-25 15:36:35 +00:00
Ged Murphy
438a6ef808 Fix more makefile paths, rbuild now builds
svn path=/branches/Tree-restructure-test/; revision=45203
2010-01-22 16:32:15 +00:00
Ged Murphy
ea02dd090f Add base include files
svn path=/branches/Tree-restructure-test/; revision=45202
2010-01-22 16:28:08 +00:00
Ged Murphy
a9b84b9c17 Fix mak file paths, rbuild now starts to build
svn path=/branches/Tree-restructure-test/; revision=45201
2010-01-22 15:55:53 +00:00
Ged Murphy
de21d6e6e2 Add base libs
svn path=/branches/Tree-restructure-test/; revision=45200
2010-01-22 15:52:35 +00:00
Ged Murphy
1af9eb8bc5 Add the build tools
svn path=/branches/Tree-restructure-test/; revision=45159
2010-01-20 09:18:53 +00:00
Ged Murphy
f06ab1f90e Base level folder structure
svn path=/branches/Tree-restructure-test/; revision=45158
2010-01-20 08:51:53 +00:00
Ged Murphy
9147696bb7 Create an empty branch for testing out tree restructure ideas. For more info see http://www.reactos.org/wiki/Techwiki:File_Layout
svn path=/branches/Tree-restructure-test/; revision=45157
2010-01-20 08:49:09 +00:00
20709 changed files with 261711 additions and 6982829 deletions

View File

@@ -16,7 +16,7 @@ Daniel Reimer <reimer.daniel@freenet.de>
David Welch <welch@cwcom.net>
Dmitry Chapyshev <dmitry@reactos.org>
Emanuele Aliberti <ea@iol.it>
Eric Kohl
Eric Kohl <ekohl@rz-online.de>
Eugene Ingerman <geneing@myrealbox.com>
Filip Navara <xnavara@volny.cz>
Frederik Leemans
@@ -31,7 +31,7 @@ Hartmut Birr <hartmut.birr@gmx.de>
Hernan Ochoa
Herve Poussineau <hpoussin@reactos.com>
Iwan Fatahi <i_fatahi@hotmail.com>
James Tabor <james.tabor@reactos.org> <jimtabor.rosdev@gmail.com> <jamestabor_rosdev@yahoo.com>
James B. Tabor <jimtabor.rosdev@gmail.com> <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
Jason Eager
Jason Filby <jasonfilby@yahoo.com>
Jason Weiler
@@ -66,7 +66,7 @@ Royce Mitchell III <royce3@ev1.net>
Samuel Serapión <samdwise51@gmail.com>
Saveliy Tretiakov <saveliyt@mail.ru>
Stefan Ginsberg <stefan__100__@hotmail.com>
Steven Edwards <winehacker@gmail.com>
Steven Edwards <steven_ed4153@yahoo.com>
Thomas Weidenmueller <w3seek@users.sourceforge.net>
Timo Kreuzer <timo.kreuzer@reactos.org>
Victor Kirhenshtein <sauros@iname.com>

1518
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

633
Makefile Normal file
View File

@@ -0,0 +1,633 @@
# Well-known targets:
#
# all (default target)
# This target builds all of ReactOS.
#
# module
# These targets builds a single module. Replace module with the name of
# the module you want to build.
#
# bootcd
# This target builds an ISO (ReactOS.iso) from which ReactOS can be booted
# and installed.
#
# livecd
# This target builds an ISO (ReactOS-Live.iso) from which ReactOS can be
# booted, but not installed.
#
# install
# This target installs all of ReactOS to a location specified by the
# ROS_INSTALL environment variable.
#
# module_install
# These targets installs a single module to a location specified by the
# ROS_INSTALL environment variable. Replace module with the name of the
# module you want to install.
#
# clean
# This target cleans (deletes) all files that are generated when building
# ReactOS.
#
# module_clean
# These targets cleans (deletes) files that are generated when building a
# single module. Replace module with the name of the module you want to
# clean.
#
# depends
# This target does a complete dependency check of the ReactOS codebase.
# This can require several minutes to complete. If you only need to check
# dependencies for a single or few modules then you can use the
# module_depends targets instead. This target can also repair a damaged or
# missing makefile-${ROS_ARCH}.auto if needed.
#
# module_depends
# These targets do a dependency check of individual modules. Replace module
# with the name of the module for which you want to check dependencies.
# This is faster than the depends target which does a complete dependency
# check of the ReactOS codebase.
#
#
# Accepted environment variables:
#
# ROS_ARCH
# This variable specifies the name of the architecture to build ReactOS for.
# The variable defaults to i386.
#
# ROS_PREFIX
# This variable specifies the prefix of the MinGW installation. On Windows
# a prefix is usually not needed, but on linux it is usually "mingw32". If
# not present and no executable named "gcc" can be found, then the prefix is
# assumed to be "mingw32". If your gcc is named i386-mingw32-gcc then set
# ROS_PREFIX to i386-mingw32. Don't include the dash (-) before gcc.
#
# ROS_INTERMEDIATE
# This variable controls where to put intermediate files. Intermediate
# files are generated files that are needed to generate the final
# output files. Examples of intermediate files include *.o, *.a, and
# *.coff. N.B. Don't put a path separator at the end. The variable
# defaults to .\obj-{ROS_ARCH}.
#
# ROS_OUTPUT
# This variable controls where to put output files. Output files are
# generated files that makes up the result of the build process.
# Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
# put a path separator at the end. The variable defaults to .\output-{ROS_ARCH}.
#
# ROS_CDOUTPUT
# This variable controls the name of the ReactOS directory on cdrom.
# The variable defaults to reactos.
# Warning: setting this value may lead to a not bootable/installable cdrom.
#
# ROS_TEMPORARY
# This variable controls where to put temporary files. Temporary files
# are (usually small) generated files that are needed to generate the
# intermediate or final output files. Examples of temporary files include
# *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put
# a path separator at the end. The variable defaults to {ROS_INTERMEDIATE}
# directory.
#
# ROS_INSTALL
# This variable controls where to install output files to when using
# 'make install'. N.B. Don't put a path separator at the end. The variable
# defaults to .\{ROS_CDOUTPUT}.
#
# ROS_BUILDMAP
# This variable controls if map files are to be generated for executable
# output files. Map files have the extension .map. The value can be either
# full (to build map files with assembly code), yes (to build map files
# without source code) or no (to not build any map files). The variable
# defaults to no.
#
# ROS_BUILDNOSTRIP
# This variable controls if non-symbol-stripped versions are to be built
# of executable output files. Non-symbol-stripped executable output files
# have .nostrip added to the filename just before the extension. The value
# can be either yes (to build non-symbol-stripped versions of executable
# output files) or no (to not build non-symbol-stripped versions of
# executable output files). The variable defaults to no.
#
# ROS_LEAN_AND_MEAN
# This variable controls if all binaries should be stripped out of useless
# data added by GCC/LD as well as of RSYM symbol data. Output binary size
# will go from 80 to 40MB, memory usage from 58 to 38MB and the install CD
# from 18 to 13MB. The variable defaults to no.
#
# ROS_GENERATE_RSYM
# This variable controls generation of RSYM symbol data. The value can be
# either yes (to generate symbol data) or no. The variable defaults to yes.
#
# ROS_RBUILDFLAGS
# Pass parameters to rbuild.
# -v Be verbose.
# -c Clean as you go. Delete generated files as soon as they are not needed anymore.
# -dd Disable automatic dependencies.
# -da Enable automatic dependencies.
# -df Enable full dependencies.
# -dm{module} Check only automatic dependencies for this module.
# -hd Disable precompiled headers.
# -mi Let make handle creation of install directories. Rbuild will not generate the directories.
# -ps Generate proxy makefiles in source tree instead of the output tree.
# -ud Disable compilation units.
# -r Input XML
#
# ROS_AUTOMAKE
# Alternate name of makefile-${ROS_ARCH}.auto
#
# ROS_BUILDENGINE
# The Build engine to be used. The variable defaults to rbuild (RBUILD_TARGET)
#
# check for versions of make that don't have features we need...
# the function "eval" is only available in 3.80+, which happens to be the minimum
# version that has the features we use...
# THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
# YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
# http://gmsl.sourceforge.net/
__gmsl_have_eval :=
__gmsl_ignore := $(eval __gmsl_have_eval := T)
ifndef __gmsl_have_eval
$(error ReactOS's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
endif
# END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
define NL
endef
.PHONY: all
.PHONY: clean
.PHONY: world
.PHONY: universe
ifneq ($(ROS_ARCH),)
ARCH := $(ROS_ARCH)
else
ARCH := i386
endif
ifeq ($(ROS_AUTOMAKE),)
ROS_AUTOMAKE=makefile-$(ARCH).auto
endif
all: $(ROS_AUTOMAKE)
.SUFFIXES:
ifeq ($(HOST),)
ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
export OSTYPE = msys
HOST=mingw32-linux
HOST_CFLAGS+=-fshort-wchar
HOST_CPPFLAGS+=-fshort-wchar
else
HOST=mingw32-windows
endif
else
HOST=mingw32-linux
HOST_CFLAGS+=-fshort-wchar
HOST_CPPFLAGS+=-fshort-wchar
endif
endif
# Default to half-verbose mode
ifeq ($(VERBOSE),no)
Q = @
HALFVERBOSEECHO = no
BUILDNO_QUIET = -q
else
ifeq ($(VERBOSE),full)
Q =
HALFVERBOSEECHO = no
BUILDNO_QUIET =
else
Q = @
HALFVERBOSEECHO = yes
BUILDNO_QUIET = -q
endif
endif
ifeq ($(HOST),mingw32-linux)
QUOTE = "
else
QUOTE =
endif
ifeq ($(HALFVERBOSEECHO),yes)
ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
ECHO_CPP =@echo $(QUOTE)[CPP] $@$(QUOTE)
ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
ECHO_HOSTCC =@echo $(QUOTE)[HOST-CC] $<$(QUOTE)
ECHO_CL =@echo $(QUOTE)[CL] $<$(QUOTE)
ECHO_AS =@echo $(QUOTE)[AS] $<$(QUOTE)
ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
ECHO_HOSTAR =@echo $(QUOTE)[HOST-AR] $@$(QUOTE)
ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
ECHO_RC =@echo $(QUOTE)[RC] $@$(QUOTE)
ECHO_CVTRES =@echo $(QUOTE)[CVTRES] $@$(QUOTE)
ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
ECHO_IMPLIB =@echo $(QUOTE)[IMPLIB] $@$(QUOTE)
ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
ECHO_HOSTLD =@echo $(QUOTE)[HOST-LD] $@$(QUOTE)
ECHO_LINK =@echo $(QUOTE)[LINK] $@$(QUOTE)
ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
ECHO_PEFIXUP =@echo $(QUOTE)[PEFIXUP] $@$(QUOTE)
ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
ECHO_STRIP =@echo $(QUOTE)[STRIP] $@$(QUOTE)
ECHO_RGENSTAT=@echo $(QUOTE)[RGENSTAT] $@$(QUOTE)
ECHO_DEPENDS =@echo $(QUOTE)[DEPENDS] $<$(QUOTE)
ECHO_RSP =@echo $(QUOTE)[RSP] $@$(QUOTE)
else
ECHO_CP =
ECHO_MKDIR =
ECHO_BUILDNO =
ECHO_INVOKE =
ECHO_PCH =
ECHO_CPP =
ECHO_CC =
ECHO_HOSTCC =
ECHO_AS =
ECHO_NASM =
ECHO_AR =
ECHO_HOSTAR =
ECHO_WINEBLD =
ECHO_WRC =
ECHO_RC =
ECHO_CVTRES =
ECHO_WIDL =
ECHO_BIN2RES =
ECHO_IMPLIB =
ECHO_LD =
ECHO_HOSTLD =
ECHO_NM =
ECHO_OBJDUMP =
ECHO_RBUILD =
ECHO_RSYM =
ECHO_WMC =
ECHO_NCI =
ECHO_CABMAN =
ECHO_CDMAKE =
ECHO_MKHIVE =
ECHO_REGTESTS=
ECHO_TEST =
ECHO_GENDIB =
ECHO_STRIP =
ECHO_RGENSTAT=
ECHO_DEPENDS =
ECHO_RSP =
endif
# Set host compiler/linker
ifeq ($(HOST_CC),)
HOST_CC = gcc
endif
ifeq ($(HOST_CPP),)
HOST_CPP = g++
endif
host_gcc = $(Q)$(HOST_CC)
host_gpp = $(Q)$(HOST_CPP)
host_ld = $(Q)ld
host_ar = $(Q)ar
host_objcopy = $(Q)objcopy
# Set target compiler/linker
ifneq ($(ROS_PREFIX),)
PREFIX_ := $(ROS_PREFIX)-
else
ifeq ($(HOST),mingw32-linux)
PREFIX_ := mingw32-
else
PREFIX_ :=
endif
endif
ifeq ($(TARGET_CC),)
TARGET_CC = $(PREFIX_)gcc
endif
ifeq ($(TARGET_CPP),)
TARGET_CPP = $(PREFIX_)g++
endif
gcc = $(Q)$(TARGET_CC)
gpp = $(Q)$(TARGET_CPP)
gas = $(Q)$(TARGET_CC) -x assembler-with-cpp
ld = $(Q)$(PREFIX_)ld
nm = $(Q)$(PREFIX_)nm
objdump = $(Q)$(PREFIX_)objdump
ar = $(Q)$(PREFIX_)ar
objcopy = $(Q)$(PREFIX_)objcopy
dlltool = $(Q)$(PREFIX_)dlltool
strip = $(Q)$(PREFIX_)strip
windres = $(Q)$(PREFIX_)windres
# Set utilities
ifeq ($(OSTYPE),msys)
HOST=mingw32-linux
endif
ifeq ($(HOST),mingw32-linux)
ifeq ($(OSTYPE),msys)
export EXEPOSTFIX = .exe
else
export EXEPOSTFIX =
endif
export SEP = /
mkdir = -$(Q)mkdir -p
checkpoint = $(Q)touch
rm = $(Q)rm -f
cp = $(Q)cp
NUL = /dev/null
else # mingw32-windows
export EXEPOSTFIX = .exe
ROS_EMPTY =
export SEP = \$(ROS_EMPTY)
mkdir = -$(Q)mkdir
checkpoint = $(Q)copy /y NUL
rm = $(Q)del /f /q
cp = $(Q)copy /y
NUL = NUL
endif
ifneq ($(ROS_INTERMEDIATE),)
INTERMEDIATE := $(ROS_INTERMEDIATE)
else
INTERMEDIATE := obj-$(ARCH)
endif
INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
ifneq ($(ROS_OUTPUT),)
OUTPUT := $(ROS_OUTPUT)
else
OUTPUT := output-$(ARCH)
endif
OUTPUT_ := $(OUTPUT)$(SEP)
ifneq ($(ROS_CDOUTPUT),)
CDOUTPUT := $(ROS_CDOUTPUT)
else
CDOUTPUT := reactos
endif
CDOUTPUT_ := $(CDOUTPUT)$(SEP)
ifneq ($(ROS_TEMPORARY),)
TEMPORARY := $(ROS_TEMPORARY)
else
TEMPORARY := $(INTERMEDIATE)
endif
TEMPORARY_ := $(TEMPORARY)$(SEP)
ifneq ($(ROS_INSTALL),)
INSTALL := $(ROS_INSTALL)
else
INSTALL := $(CDOUTPUT)
endif
INSTALL_ := $(INSTALL)$(SEP)
RBUILD_FLAGS := -rReactOS-$(ARCH).rbuild -DARCH=$(ARCH)
$(INTERMEDIATE):
$(ECHO_MKDIR)
${mkdir} $@
ifneq ($(INTERMEDIATE),$(OUTPUT))
$(OUTPUT):
$(ECHO_MKDIR)
${mkdir} $@
endif
ifneq ($(TEMPORARY),$(INTERMEDIATE))
ifneq ($(TEMPORARY),$(OUTPUT))
$(TEMPORARY):
$(ECHO_MKDIR)
${mkdir} $@
endif
endif
BUILDNO_H = $(INTERMEDIATE_)sdk$(SEP)include$(SEP)reactos$(SEP)buildno.h
include sdk/libs/lib.mak
include sdk/tools/tools.mak
-include $(ROS_AUTOMAKE)
PREAUTO := \
$(BIN2C_TARGET) \
$(BIN2RES_TARGET) \
$(BUILDNO_H) \
$(NCI_SERVICE_FILES) \
$(GENDIB_DIB_FILES)
ifeq ($(ARCH),powerpc)
PREAUTO += $(OFW_INTERFACE_SERVICE_FILES) $(PPCMMU_TARGETS)
endif
ifeq ($(ROS_BUILDENGINE),)
ROS_BUILDENGINE=$(RBUILD_TARGET)
endif
$(ROS_AUTOMAKE): $(ROS_BUILDENGINE) $(XMLBUILDFILES) | $(BUILDNO_H)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw
world: all bootcd livecd
universe:
$(MAKE) KDBG=1 DBG=1 \
ROS_AUTOMAKE=makefile-$(ARCH)-kd.auto \
ROS_INSTALL=reactos-$(ARCH)-kd \
ROS_INTERMEDIATE=obj-$(ARCH)-kd \
ROS_OUTPUT=output-$(ARCH)-kd \
world
$(MAKE) KDBG=0 DBG=1 \
ROS_AUTOMAKE=makefile-$(ARCH)-d.auto \
ROS_INSTALL=reactos-$(ARCH)-d \
ROS_INTERMEDIATE=obj-$(ARCH)-d \
ROS_OUTPUT=output-$(ARCH)-d \
world
$(MAKE) KDBG=0 DBG=0 \
ROS_AUTOMAKE=makefile-$(ARCH)-r.auto \
ROS_INSTALL=reactos-$(ARCH)-r \
ROS_INTERMEDIATE=obj-$(ARCH)-r \
ROS_OUTPUT=output-$(ARCH)-r \
world
.PHONY: rgenstat
rgenstat: $(RGENSTAT_TARGET)
$(ECHO_RGENSTAT)
$(Q)$(RGENSTAT_TARGET) apistatus.lst apistatus.xml
.PHONY: cb
cb: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) cb
.PHONY: msbuild
msbuild: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msbuild
.PHONY: msbuild_clean
msbuild_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msbuild
.PHONY: depmap
depmap: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) depmap
.PHONY: vreport
vreport:$(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) vreport
.PHONY: msvc
msvc: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msvc
.PHONY: msvc6
msvc6: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs6.00 -voversionconfiguration msvc
.PHONY: msvc7
msvc7: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -voversionconfiguration msvc
.PHONY: msvc71
msvc71: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -voversionconfiguration msvc
.PHONY: msvc8
msvc8: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -voversionconfiguration msvc
.PHONY: msvc9
msvc9: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs9.00 -voversionconfiguration msvc
.PHONY: msvc10
msvc10: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs10.00 -voversionconfiguration msvc
.PHONY: msvc6_clean
msvc6_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
.PHONY: msvc7_clean
msvc7_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
.PHONY: msvc71_clean
msvc71_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
.PHONY: msvc8_clean
msvc8_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.00 -voversionconfiguration msvc
.PHONY: msvc9_clean
msvc9_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs9.00 -voversionconfiguration msvc
.PHONY: msvc10_clean
msvc10_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs10.00 -voversionconfiguration msvc
.PHONY: msvc_clean
msvc_clean: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msvc
.PHONY: msvc_clean_all
msvc_clean_all: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.10 -voversionconfiguration msvc
.PHONY: msvc7_install_debug
msvc7_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug -voversionconfiguration msvc
.PHONY: msvc7_install_release
msvc7_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease -voversionconfiguration msvc
.PHONY: msvc7_install_speed
msvc7_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed -voversionconfiguration msvc
.PHONY: msvc71_install_debug
msvc71_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug -voversionconfiguration msvc
.PHONY: msvc71_install_release
msvc71_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease -voversionconfiguration msvc
.PHONY: msvc71_install_speed
msvc71_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed -voversionconfiguration msvc
.PHONY: msvc8_install_debug
msvc8_install_debug: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug -voversionconfiguration msvc
.PHONY: msvc8_install_release
msvc8_install_release: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease -voversionconfiguration msvc
.PHONY: msvc8_install_speed
msvc8_install_speed: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed -voversionconfiguration msvc
.PHONY: makefile_auto_clean
makefile_auto_clean:
-@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
.PHONY: clean
clean: makefile_auto_clean
.PHONY: depends
depends: $(ROS_BUILDENGINE)
$(ECHO_RBUILD)
$(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw

View File

@@ -18,6 +18,7 @@
<define name="TARGET_amd64" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<define name ="NO_UNDERSCORE_PREFIX" />
<property name="PLATFORM" value="PC"/>
<property name="usewrc" value="false"/>
@@ -34,8 +35,8 @@
<!-- compilerflag compiler="cc,cxx">-gstabs+</compilerflag -->
<!-- compilerflag compiler="as">-gstabs+</compilerflag -->
<compilerflag>-U_X86_</compilerflag>
<compilerflag>-UWIN32</compilerflag>
<compilerflag>-Wno-format</compilerflag>
<compilerflag>-fno-leading-underscore</compilerflag>
</group>
<group linkerset="ld">
@@ -44,14 +45,31 @@
<linkerflag>-section-alignment=0x1000</linkerflag>
<linkerflag>--unique=.eh_frame</linkerflag>
<linkerflag>-static</linkerflag>
<linkerflag>-fno-leading-underscore</linkerflag>
<linkerflag>-shared</linkerflag>
<linkerflag>--exclude-all-symbols</linkerflag>
</group>
<if property="USERMODE" value="1">
<directory name="base">
<xi:include href="base/base.rbuild" />
<directory name="applications">
<xi:include href="base/applications/applications.rbuild" />
</directory>
<directory name="services">
<xi:include href="base/services/services.rbuild" />
</directory>
<directory name="setup">
<xi:include href="base/setup/setup.rbuild" />
</directory>
<directory name="shell">
<directory name="cmd">
<xi:include href="base/shell/cmd/cmd.rbuild" />
</directory>
<directory name="explorer-new">
<xi:include href="base/shell/explorer-new/explorer.rbuild" />
</directory>
</directory>
<directory name="system">
<xi:include href="base/system/system.rbuild" />
</directory>
</directory>
<directory name="dll">
<xi:include href="dll/dll.rbuild" />

View File

@@ -7,18 +7,18 @@
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<xi:include href="ReactOS-generic.rbuild" />
<!-- <define name="_M_ARM" /> Already defined by toolchain -->
<!-- <define name="_M_ARM" /> Already defined by toolchain -->
<define name="_ARM_" />
<define name="__arm__" />
<define name="TARGET_arm" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<define name="USE_COMPILER_EXCEPTIONS" />
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<include>include/reactos/arm</include>
<include>include/reactos/arm</include>
<if property="SARCH" value="versatile">
<define name="BOARD_CONFIG_VERSATILE"/>
@@ -29,17 +29,17 @@
<compilerflag>-ftracer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-Wno-attributes</compilerflag>
<compilerflag>-U_UNICODE</compilerflag>
<compilerflag>-UUNICODE</compilerflag>
<compilerflag>-Wno-attributes</compilerflag>
<compilerflag>-U_UNICODE</compilerflag>
<compilerflag>-UUNICODE</compilerflag>
</group>
<define name="__MSVCRT__"/> <!-- DUBIOUS -->
<group linkerset="ld">
<linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
<linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
@@ -53,7 +53,10 @@
<directory name="drivers">
<directory name="csq">
<xi:include href="lib/drivers/csq/csq.rbuild" />
</directory>
</directory>
</directory>
<directory name="cportlib">
<xi:include href="lib/cportlib/cportlib.rbuild" />
</directory>
<directory name="debugsup">
<xi:include href="lib/debugsup/debugsup.rbuild" />
@@ -74,6 +77,9 @@
<directory name="inflib">
<xi:include href="lib/inflib/inflib.rbuild" />
</directory>
<directory name="newinflib">
<xi:include href="lib/newinflib/inflib.rbuild" />
</directory>
<directory name="cmlib">
<xi:include href="lib/cmlib/cmlib.rbuild" />
</directory>
@@ -88,6 +94,9 @@
<xi:include href="lib/sdk/crt/crt.rbuild" />
<xi:include href="lib/sdk/crt/libcntpr.rbuild" />
</directory>
<directory name="ioevent">
<xi:include href="lib/sdk/ioevent/ioevent.rbuild" />
</directory>
<directory name="nt">
<xi:include href="lib/sdk/nt/nt.rbuild" />
</directory>
@@ -146,9 +155,9 @@
</directory>
<directory name="base">
<directory name="system">
<directory name="smss">
<xi:include href="base/system/smss/smss.rbuild" />
</directory>
<directory name="smss">
<xi:include href="base/system/smss/smss.rbuild" />
</directory>
</directory>
</directory>
</project>

View File

@@ -63,28 +63,27 @@
<define name="_SETUPAPI_VER">0x600</define>
</if>
<include>.</include>
<include>include</include>
<include root="intermediate">include</include>
<include>include/psdk</include>
<include root="intermediate">include/psdk</include>
<include>include/dxsdk</include>
<include root="intermediate">include/dxsdk</include>
<include>include/crt</include>
<include compilerset="gcc">include/crt/mingw32</include>
<include compilerset="msc">include/crt/msc</include>
<include>include/ddk</include>
<include>include/GL</include>
<include>include/ndk</include>
<include>include/reactos</include>
<include root="intermediate">include/reactos</include>
<include root="intermediate">include/reactos/mc</include>
<include>include/reactos/libs</include>
<include>sdk/include</include>
<include root="intermediate">sdk/include</include>
<include>sdk/include/psdk</include>
<include root="intermediate">sdk/include/psdk</include>
<include>sdk/include/dxsdk</include>
<include root="intermediate">sdk/include/dxsdk</include>
<include>sdk/include/crt</include>
<include compilerset="gcc">sdk/include/crt/mingw32</include>
<include compilerset="msc">sdk/include/crt/msc</include>
<include>sdk/include/ddk</include>
<include>sdk/include/GL</include>
<include>sdk/include/ndk</include>
<include>sdk/include/reactos</include>
<include root="intermediate">sdk/include/reactos</include>
<include root="intermediate">sdk/include/reactos/mc</include>
<include>sdk/include/reactos/libs</include>
<include host="true">include</include>
<include host="true" root="intermediate">include</include>
<include host="true">include/reactos</include>
<include host="true">include/reactos/wine</include>
<include host="true">sdk/include</include>
<include host="true" root="intermediate">sdk/include</include>
<include host="true">sdk/include/reactos</include>
<include host="true">sdk/include/reactos/wine</include>
<group compilerset="gcc">
<compilerflag>-Wall</compilerflag>

45
ReactOS-i386.rbuild Normal file
View File

@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="makefile-i386.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config.rbuild">
<xi:fallback>
<xi:include href="config.template.rbuild" />
</xi:fallback>
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<define name="_M_IX86" />
<define name="_X86_" />
<define name="__i386__" />
<define name="TARGET_i386" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<define name="_USE_32BIT_TIME_T" />
<property name="PLATFORM" value="PC"/>
<group compilerset="gcc">
<if property="OPTIMIZE" value="1">
<compilerflag>-ftracer</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag>
</if>
<compilerflag>-fms-extensions</compilerflag>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag>
<compilerflag compiler="midl">-m32 --win32</compilerflag>
<compilerflag compiler="cc,cxx">-gstabs+</compilerflag>
<compilerflag compiler="cc,cxx">-fno-set-stack-executable</compilerflag>
<compilerflag compiler="cc,cxx">-fno-optimize-sibling-calls</compilerflag>
<compilerflag compiler="as">-gstabs+</compilerflag>
</group>
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<directory name="sdk">
<xi:include href="sdk/sdk.rbuild" />
</directory>
</project>

View File

@@ -27,7 +27,7 @@
<property name="BASEADDRESS_MSDVBNP" value="0x58280000" />
<property name="BASEADDRESS_MSG711ACM" value="0x584f0000" />
<property name="BASEADDRESS_IMAADP32ACM" value="0x585e0000" />
<property name="BASEADDRESS_BDAPLGIN" value="0x58600000" />
<property name="BASEADDRESS_BDAPLGIN" value="0x58600000" />
<property name="BASEADDRESS_TELEPHON" value="0x58750000" />
<property name="BASEADDRESS_PWRCFG" value="0x587e0000" />
<property name="BASEADDRESS_MMSYS" value="0x588a0000" />
@@ -133,6 +133,7 @@
<property name="BASEADDRESS_OLESVR32" value="0x71dd0000" />
<property name="BASEADDRESS_OLECLI32" value="0x71df0000" />
<property name="BASEADDRESS_OLETHK32" value="0x71e10000" />
<property name="BASEADDRESS_NETEVENT" value="0x71e70000" />
<property name="BASEADDRESS_DPLAY" value="0x71e80000" />
<property name="BASEADDRESS_SECURITY" value="0x71f10000" />
<property name="BASEADDRESS_MSSIGN32" value="0x720c0000" />
@@ -187,8 +188,8 @@
<property name="BASEADDRESS_RPCRT4" value="0x76000000" />
<property name="BASEADDRESS_SHLWAPI" value="0x76100000" />
<property name="BASEADDRESS_INETCOMM" value="0x76140000" />
<property name="BASEADDRESS_COMCTL32" value="0x76160000" />
<property name="BASEADDRESS_COMDLG32" value="0x76210000" />
<property name="BASEADDRESS_COMCTL32" value="0x76170000" />
<property name="BASEADDRESS_COMDLG32" value="0x76230000" />
<property name="BASEADDRESS_WINSTA" value="0x762f0000" />
<property name="BASEADDRESS_IMM32" value="0x76320000" />
<property name="BASEADDRESS_D3D8THK" value="0x76340000" />
@@ -202,15 +203,15 @@
<property name="BASEADDRESS_WAVEMAP" value="0x76610000" />
<property name="BASEADDRESS_MPR" value="0x76620000" />
<property name="BASEADDRESS_MSHTML" value="0x76650000" />
<property name="BASEADDRESS_ODBC32" value="0x76660000" />
<property name="BASEADDRESS_SETUPAPI" value="0x76660000" />
<property name="BASEADDRESS_CRYPTDLL" value="0x76740000" />
<property name="BASEADDRESS_SHFOLDER" value="0x76760000" />
<property name="BASEADDRESS_NTDSAPI" value="0x76780000" />
<property name="BASEADDRESS_NTMARTA" value="0x768a0000" />
<property name="BASEADDRESS_RASDLG" value="0x768d0000" />
<property name="BASEADDRESS_GDIPLUS" value="0x76a00000" />
<property name="BASEADDRESS_ATL" value="0x76a80000" />
<property name="BASEADDRESS_ODBC32" value="0x76710000" />
<property name="BASEADDRESS_SETUPAPI" value="0x76730000" />
<property name="BASEADDRESS_CRYPTDLL" value="0x768f0000" />
<property name="BASEADDRESS_SHFOLDER" value="0x76900000" />
<property name="BASEADDRESS_NTDSAPI" value="0x76910000" />
<property name="BASEADDRESS_NTMARTA" value="0x76920000" />
<property name="BASEADDRESS_RASDLG" value="0x76930000" />
<property name="BASEADDRESS_GDIPLUS" value="0x76a70000" />
<property name="BASEADDRESS_ATL" value="0x76ac0000" />
<property name="BASEADDRESS_SFC" value="0x76b50000" />
<property name="BASEADDRESS_CREDUI" value="0x76bf0000" />
<property name="BASEADDRESS_SFC_OS" value="0x76c10000" />
@@ -241,7 +242,7 @@
<property name="BASEADDRESS_WSHIRDA" value="0x777f0000" />
<property name="BASEADDRESS_VERSION" value="0x77a40000" />
<property name="BASEADDRESS_OLE32" value="0x77a50000" />
<property name="BASEADDRESS_OLEPRO32" value="0x77b10000" />
<property name="BASEADDRESS_OLEPRO32" value="0x77b20000" />
<property name="BASEADDRESS_ACTIVEDS" value="0x77cb0000" />
<property name="BASEADDRESS_ADVAPI32" value="0x77dc0000" />
<property name="BASEADDRESS_USER32" value="0x77e50000" />

View File

@@ -1,608 +0,0 @@
// irc_test.cpp
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif//_MSC_VER
#include <time.h>
#include <stdio.h>
#include "File.h"
#include "ssprintf.h"
#include "trim.h"
#include "IRCClient.h"
#include "config.h"
using std::string;
using std::vector;
//vector<string> tech, module, dev, stru, period, status, type, func, irql, curse, cursecop;
class List
{
public:
string name;
bool macro;
std::vector<std::string> list;
string tag;
int last;
List() { last = -1; }
List ( const char* _name, bool _macro ) : name(_name), macro(_macro)
{
tag = ssprintf("%%%s%%",_name);
last = -1;
}
};
vector<List> lists;
vector<string> ops;
void ImportList ( const char* listname, bool macro )
{
lists.push_back ( List ( listname, macro ) );
List& list = lists.back();
File f ( ssprintf("%s.txt",listname).c_str(), "r" );
string line;
while ( f.next_line ( line, true ) )
list.list.push_back ( line );
}
const char* ListRand ( List& list )
{
vector<string>& l = list.list;
if ( !l.size() )
{
static string nothing;
nothing = ssprintf ( "<list '%s' empty>", list.name.c_str() );
return nothing.c_str();
}
else if ( l.size() == 1 )
return l[0].c_str();
int sel = list.last;
while ( sel == list.last )
sel = rand()%l.size();
list.last = sel;
return l[sel].c_str();
}
const char* ListRand ( int i )
{
return ListRand ( lists[i] );
}
int GetListIndex ( const char* listname )
{
for ( int i = 0; i < lists.size(); i++ )
{
if ( !stricmp ( lists[i].name.c_str(), listname ) )
return i;
}
return -1;
}
List& GetList ( const char* listname )
{
return lists[GetListIndex(listname)];
}
const char* ListRand ( const char* list )
{
int i = GetListIndex ( list );
if ( i < 0 )
return NULL;
return ListRand(i);
}
string TaggedReply ( const char* listname )
{
string t = ListRand(listname);
string out;
const char* p = t.c_str();
while ( *p )
{
if ( *p == '%' )
{
bool found = false;
for ( int i = 0; i < lists.size() && !found; i++ )
{
if ( lists[i].macro && !strnicmp ( p, lists[i].tag.c_str(), lists[i].tag.size() ) )
{
out += ListRand(i);
p += lists[i].tag.size();
found = true;
}
}
if ( !found )
out += *p++;
}
const char* p2 = strchr ( p, '%' );
if ( !p2 )
p2 = p + strlen(p);
if ( p2 > p )
{
out += string ( p, p2-p );
p = p2;
}
}
return out;
}
string gobble ( string& s, const char* delim )
{
const char* p = s.c_str();
p += strspn ( p, delim );
const char* p2 = strpbrk ( p, delim );
if ( !p2 ) p2 = p + strlen(p);
string out ( p, p2-p );
p2 += strspn ( p2, delim );
s = string ( p2 );
return out;
}
bool isop ( const string& who )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == who )
return true;
}
return false;
}
// do custom stuff with the IRCClient from your subclass via the provided callbacks...
class MyIRCClient : public IRCClient
{
File flog;
clock_t brake_silence;
// wait another 30 mins to brake the silence
#define NOIDLE brake_silence = clock () + 30 * CLK_TCK * 60
void CheckIdle ( void )
{
while (true) // _inRun
{
while (clock() < brake_silence)
Sleep(10000);
string out = TaggedReply("idle");
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
Action ( CHANNEL, &out[4] );
else
PrivMsg ( CHANNEL, out );
NOIDLE;
}
}
static void THREADAPI CallMe ( MyIRCClient* irc )
{
irc->CheckIdle();
}
public:
MyIRCClient()
{
NOIDLE;
ThreadPool::Instance().Launch ( (ThreadPoolFunc*)MyIRCClient::CallMe, this );
flog.open ( "arch.log", "r+" );
}
// see IRCClient.h for documentation on these callbacks...
bool OnConnected()
{
return true;
}
bool OnJoin ( const string& user, const string& channel )
{
//printf ( "user '%s' joined channel '%s'\n", user.c_str(), channel.c_str() );
return true;
}
bool OnPart ( const std::string& user, const std::string& channel )
{
std::vector<std::string>::iterator it = ops.begin();
for ( ; it != ops.end(); it++ )
{
if ( *it == user )
{
printf ( "remove '%s' to ops list\n", user.c_str() );
ops.erase ( it );
}
}
return true;
}
bool OnNick ( const std::string& oldNick, const std::string& newNick )
{
for ( int i = 0; i < ops.size(); i++ )
{
if ( ops[i] == oldNick )
{
printf ( "op '%s' changed nick to '%s'\n", oldNick.c_str(), newNick.c_str() );
ops[i] = newNick;
return true;
}
}
return true;
}
bool OnEndChannelUsers ( const string& channel )
{
return true;
}
bool OnPrivMsg ( const string& from, const string& text )
{
//flog.flush();
printf ( "<%s> %s\n", from.c_str(), text.c_str() );
flog.printf ( "<%s> %s\n", from.c_str(), text.c_str() );
if ( !isop(from) )
return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
else if ( strnicmp ( text.c_str(), "!say ", 5 ) )
return PrivMsg ( from, "Talk to me on normal Chanel" );
string say = trim(&text[5]);
if ( !strnicmp ( say.c_str(), "/me ", 4 ) )
return Action ( CHANNEL, trim(&say[4]) );
else
return PrivMsg ( CHANNEL, trim(say) );
}
bool OnChannelMsg ( const string& channel, const string& from, const string& text )
{
fflush ( flog );
printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
flog.printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
NOIDLE; // add 30 mins till idle
bool found_name = false;
string text2 ( text );
strlwr ( &text2[0] );
if ( !strnicmp ( text.c_str(), BOTNAME, strlen(BOTNAME) ) )
found_name = true;
string s ( text );
if ( found_name )
gobble ( s, " \t" ); // remove bot name
// command
if ( s[0] == '!' )
{
bool from_op = isop(from);
string cmd = gobble ( s, " \t" );
// from all
if ( false && cmd == "!svn" && from == "TechBot" ) // || cmd == "!help" && !TechBotOnline
{
PrivMsg ( channel, "For my help try !what." );
}
// from normel user
else if ( !from_op )
{
if ( cmd == "!grovel" )
{
string out = ssprintf(TaggedReply("nogrovel").c_str(),from.c_str());
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
else if ( cmd == "!what" )
{
return PrivMsg ( channel, ssprintf("For you, %s, I only support the \"!grovel\" command.", from.c_str()).c_str() );
}
else if ( cmd == "!grovel" || cmd == "!kiss" || cmd == "!hug"
|| cmd == "!give" || cmd == "!what" || cmd == "!add" || cmd == "!remove" )
{
PrivMsg ( channel, ssprintf("%s: I only take commands from ops",from.c_str()) );
}
}
// from op
else if ( cmd == "!grovel" )
{
string out = ssprintf(TaggedReply("grovel").c_str(),from.c_str());
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
else if ( cmd == "!kiss" )
{
if ( s.size() )
return Action ( channel, ssprintf("kisses %s",s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else if ( cmd == "!hug" )
{
if ( s.size() )
return Action ( channel, ssprintf("hugs %s",s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else if ( cmd == "!give" )
{
string who = gobble(s," \t");
if ( who.size() && s.size() )
return Action ( channel, ssprintf("gives %s a %s",who.c_str(),s.c_str()) );
else
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
else if ( cmd == "!what" )
{
PrivMsg ( channel, "For ops I support the following commands:" );
PrivMsg ( channel, "!grovel" );
PrivMsg ( channel, "!kiss" );
PrivMsg ( channel, "!hug" );
PrivMsg ( channel, "!give" );
PrivMsg ( channel, "!say (the input is a private message)" );
PrivMsg ( channel, "!add" );
PrivMsg ( channel, "!remove" );
PrivMsg ( channel, " - for more info see wiki" );
}
else if ( cmd == "!add" )
{
string listname = gobble ( s, " \t" );
int i = GetListIndex ( listname.c_str() );
if ( i == -1 )
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
List& list = lists[i];
if ( s[0] == '\"' || s[0] == '\'' )
{
char delim = s[0];
const char* p = &s[1];
const char* p2 = strchr ( p, delim );
if ( !p2 )
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
s = string ( p, p2-p );
}
for ( i = 0; i < list.list.size(); i++ )
{
if ( list.list[i] == s )
return PrivMsg ( channel, ssprintf("%s: entry already exists in list '%s'",from.c_str(),listname.c_str()) );
}
if ( !stricmp ( listname.c_str(), "curse" ) )
strlwr ( &s[0] );
list.list.push_back ( s );
{
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
for ( i = 0; i < list.list.size(); i++ )
f.printf ( "%s\n", list.list[i].c_str() );
}
return PrivMsg ( channel, ssprintf("%s: entry added to list '%s'",from.c_str(),listname.c_str()) );
}
else if ( cmd == "!remove" )
{
string listname = gobble ( s, " \t" );
int i = GetListIndex ( listname.c_str() );
if ( i == -1 )
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
List& list = lists[i];
if ( s[0] == '\"' || s[0] == '\'' )
{
char delim = s[0];
const char* p = &s[1];
const char* p2 = strchr ( p, delim );
if ( !p2 )
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
s = string ( p, p2-p );
}
std::vector<std::string>::iterator it = list.list.begin();
for ( ; it != list.list.end(); it++ )
{
if ( *it == s )
{
list.list.erase ( it );
{
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
it = list.list.begin();
for ( ; it < list.list.end(); it++ )
f.printf ( "%s\n", it->c_str() );
}
return PrivMsg ( channel, ssprintf("%s: entry removed from list '%s'",from.c_str(),listname.c_str()) );
}
}
return PrivMsg ( channel, ssprintf("%s: entry doesn't exist in list '%s'",from.c_str(),listname.c_str()) );
}
else
{
if (found_name)
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
}
} // if (command)
bool found_curse = false;
static vector<string>& curse = GetList("curse").list;
text2 = " " + text2 + " ";
for ( int i = 0; i < curse.size() && !found_curse; i++ )
{
if ( strstr ( text2.c_str(), curse[i].c_str() ) )
found_curse = true;
}
if ( found_curse )
{
static List& cursecop = GetList("cursecop");
return PrivMsg ( channel, ssprintf("%s: %s", from.c_str(), ListRand(cursecop)) );
}
string botname (BOTNAME);
strlwr ( &botname[0] );
//botname = " " + botname + " ";
if ( strstr(text2.c_str(), botname.c_str()) || strstr(text2.c_str(), " arch ") || found_name )
{
string out = ssprintf("%s: %s", from.c_str(), TaggedReply("tech").c_str());
flog.printf ( "TECH-REPLY: %s\n", out.c_str() );
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
return Action ( channel, &out[4] );
else
return PrivMsg ( channel, out );
}
return true;
} // On Chanel Message
bool OnChannelMode ( const string& channel, const string& mode )
{
//printf ( "OnChannelMode(%s,%s)\n", channel.c_str(), mode.c_str() );
return true;
}
bool OnUserModeInChannel ( const string& src, const string& channel, const string& mode, const string& target )
{
printf ( "OnUserModeInChannel(%s,%s,%s,%s)\n", src.c_str(), channel.c_str(), mode.c_str(), target.c_str() );
const char* p = mode.c_str();
if ( !p )
return true;
while ( *p )
{
switch ( *p++ )
{
case '+':
while ( *p != 0 && *p != ' ' )
{
if ( *p == 'o' )
{
printf ( "adding '%s' to ops list\n", target.c_str() );
ops.push_back ( target );
}
break;
}
break;
case '-':
while ( *p != 0 && *p != ' ' )
{
if ( *p == 'o' )
{
std::vector<std::string>::iterator it = ops.begin();
for ( ; it != ops.end(); it++ )
{
if ( *it == target )
{
printf ( "remove '%s' to ops list\n", target.c_str() );
ops.erase ( it );
}
}
break;
}
}
}
}
return true;
}
bool OnMode ( const string& user, const string& mode )
{
//printf ( "OnMode(%s,%s)\n", user.c_str(), mode.c_str() );
return true;
}
bool OnChannelUsers ( const string& channel, const vector<string>& users )
{
//printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
for ( int i = 0; i < users.size(); i++ )
{
if ( users[i][0] == '@' )
ops.push_back ( &users[i][1] );
/*if ( i )
printf ( ", " );
printf ( "%s", users[i].c_str() );*/
}
//printf ( "\n" );
return true;
}
bool OnKick ( void )
{
Join(CHANNEL);
return true;
}
bool OnBanned ( const std::string& channel )
{
Sleep(10000);
return Join(CHANNEL);
}
};
int main ( int argc, char** argv )
{
srand ( time(NULL) );
ImportList ( "dev", true );
ImportList ( "func", true );
ImportList ( "dev", true );
ImportList ( "func", true );
ImportList ( "irql", true );
ImportList ( "module", true );
ImportList ( "period", true );
ImportList ( "status", true );
ImportList ( "stru", true );
ImportList ( "type", true );
ImportList ( "tech", false );
ImportList ( "curse", false );
ImportList ( "cursecop", false );
ImportList ( "grovel", false );
ImportList ( "nogrovel", false );
ImportList ( "idle", false );
#ifdef _DEBUG
printf ( "initializing IRCClient debugging\n" );
IRCClient::SetDebug ( true );
#endif//_DEBUG
while (true)
{
printf ( "calling suStartup()\n" );
suStartup();
printf ( "creating IRCClient object\n" );
MyIRCClient irc;
printf ( "connecting to freenode\n" );
if ( !irc.Connect ( SERVER ) ) // irc.freenode.net
{
printf ( "couldn't connect to server\n" );
Sleep(10000);
continue;
}
printf ( "sending user command\n" );
if ( !irc.User ( BOTNAME, "reactos.com", SERVER, "ArchBlackmann" ) )
{
printf ( "USER command failed, retying ...\n" );
Sleep(10000);
continue;
}
printf ( "sending nick\n" );
if ( !irc.Nick ( BOTNAME ) )
{
printf ( "NICK command failed, retying ...\n" );
Sleep(10000);
continue;
}
printf ( "setting mode\n" );
if ( !irc.Mode ( MODE ) )
{
printf ( "MODE command failed, retying ...\n" );
Sleep(10000);
continue;
}
printf ( "joining channel\n" );
if ( !irc.Join ( CHANNEL ) )
{
printf ( "JOIN command failed, retying ...\n" );
Sleep(10000);
continue;
}
printf ( "entering irc client processor\n" );
irc.Run ( false ); // do the processing in this thread...
}
return 0;
}

View File

@@ -1,216 +0,0 @@
# Microsoft Developer Studio Project File - Name="ArchBlackmann" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=ArchBlackmann - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ArchBlackmann.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ArchBlackmann.mak" CFG="ArchBlackmann - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ArchBlackmann - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ArchBlackmann - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ArchBlackmann - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "ArchBlackmann - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "ArchBlackmann - Win32 Release"
# Name "ArchBlackmann - Win32 Debug"
# Begin Source File
SOURCE=.\ArchBlackmann.cpp
# End Source File
# Begin Source File
SOURCE=.\auto_ptr.h
# End Source File
# Begin Source File
SOURCE=.\auto_vector.h
# End Source File
# Begin Source File
SOURCE=.\base64.cpp
# End Source File
# Begin Source File
SOURCE=.\base64.h
# End Source File
# Begin Source File
SOURCE=.\chomp.cpp
# End Source File
# Begin Source File
SOURCE=.\chomp.h
# End Source File
# Begin Source File
SOURCE=.\config.h
# End Source File
# Begin Source File
SOURCE=.\cram_md5.cpp
# End Source File
# Begin Source File
SOURCE=.\cram_md5.h
# End Source File
# Begin Source File
SOURCE=.\File.cpp
# End Source File
# Begin Source File
SOURCE=.\File.h
# End Source File
# Begin Source File
SOURCE=.\IRCClient.cpp
# End Source File
# Begin Source File
SOURCE=.\IRCClient.h
# End Source File
# Begin Source File
SOURCE=.\MD5.cpp
# End Source File
# Begin Source File
SOURCE=.\MD5.h
# End Source File
# Begin Source File
SOURCE=.\panic.cpp
# End Source File
# Begin Source File
SOURCE=.\panic.h
# End Source File
# Begin Source File
SOURCE=.\QueueT.h
# End Source File
# Begin Source File
SOURCE=.\Reli.h
# End Source File
# Begin Source File
SOURCE=.\ReliMT.cpp
# End Source File
# Begin Source File
SOURCE=.\ReliMT.h
# End Source File
# Begin Source File
SOURCE=.\SockUtils.cpp
# End Source File
# Begin Source File
SOURCE=.\SockUtils.h
# End Source File
# Begin Source File
SOURCE=.\SplitJoin.cpp
# End Source File
# Begin Source File
SOURCE=.\SplitJoin.h
# End Source File
# Begin Source File
SOURCE=.\ssprintf.cpp
# End Source File
# Begin Source File
SOURCE=.\ssprintf.h
# End Source File
# Begin Source File
SOURCE=.\ThreadPool.cpp
# End Source File
# Begin Source File
SOURCE=.\ThreadPool.h
# End Source File
# Begin Source File
SOURCE=.\trim.cpp
# End Source File
# Begin Source File
SOURCE=.\trim.h
# End Source File
# Begin Source File
SOURCE=.\verify.h
# End Source File
# End Target
# End Project

View File

@@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "ArchBlackmann"=.\ArchBlackmann.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,265 +0,0 @@
// File.cpp
// (C) 2002-2004 Royce Mitchell III
// Dually licensed under BSD & LGPL
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif//_MSC_VER
#include <stdio.h>
#include <stdarg.h>
#include "File.h"
#ifndef nelem
#define nelem(x) ( sizeof(x) / sizeof(x[0]) )
#endif//nelem
typedef File::filesize_t filesize_t;
typedef File::fileoff_t fileoff_t;
fileoff_t File::seek ( fileoff_t offset )
{
#ifdef WIN32
if ( _f->_flag & _IOWRT ) // is there pending output?
fflush ( _f );
// reset "buffered input" variables
_f->_cnt = 0;
_f->_ptr = _f->_base;
// make sure we're going forward
if ( _f->_flag & _IORW )
_f->_flag &= ~(_IOREAD|_IOWRT);
return _lseeki64 ( _fileno(_f), offset, SEEK_SET );
#else//UNIX
return lseek64 ( fileno(_f), offset, SEEK_SET );
#endif
}
std::string File::getline ( bool strip_crlf /*= false*/ )
{
std::string s = "";
char buf[256];
for ( ;; )
{
*buf = 0;
fgets ( buf, nelem(buf)-1, _f );
if ( !*buf )
break;
s += buf;
if ( strchr ( "\r\n", buf[strlen(buf)-1] ) )
break;
}
if ( strip_crlf && s.size() )
{
char* p = strpbrk ( &s[0], "\r\n" );
if ( p )
{
*p = '\0';
s.resize ( p-&s[0] );
}
}
return s;
}
std::wstring File::wgetline ( bool strip_crlf /*= false*/ )
{
std::wstring s = L"";
wchar_t buf[256];
for ( ;; )
{
*buf = 0;
fgetws ( buf, nelem(buf)-1, _f );
if ( !*buf )
break;
s += buf;
if ( wcschr ( L"\r\n", buf[wcslen(buf)-1] ) )
break;
}
if ( strip_crlf && s.size() )
{
wchar_t* p = wcspbrk ( &s[0], L"\r\n" );
if ( p )
{
*p = L'\0';
s.resize ( (p-&s[0])/sizeof(wchar_t) );
}
}
return s;
}
// this function searches for the next end-of-line and puts all data it
// finds until then in the 'line' parameter.
//
// call continuously until the function returns false ( no more data )
bool File::next_line ( std::string& line, bool strip_crlf )
{
line = getline(strip_crlf);
// indicate that we're done *if*:
// 1) there's no more data, *and*
// 2) we're at the end of the file
return line.size()>0 || !eof();
}
bool File::next_line ( std::wstring& line, bool strip_crlf )
{
line = wgetline ( strip_crlf );
return line.size()>0 || !eof();
}
/*
example usage:
bool mycallback ( const std::string& line, int line_number, long lparam )
{
std::cout << line << std::endl;
return true; // continue enumeration
}
File f ( "file.txt", "rb" ); // open file for binary read-only ( i.e. "rb" )
f.enum_lines ( mycallback, 0, true );
*/
/*bool File::enum_lines ( bool (*callback)(const std::string& line, int line_number, long lparam), long lparam, bool strip_crlf )
{
int line_number = 0;
for ( ;; )
{
std::string s = getline(strip_crlf);
line_number++;
if ( !s.size() )
{
if ( eof() )
return true;
else
continue;
}
if ( !(*callback) ( s, line_number, lparam ) )
return false;
}
}*/
filesize_t File::length() const
{
#ifdef WIN32
return _filelengthi64 ( _fileno(_f) );
#elif defined(UNIX)
struct stat64 file_stat;
verify(fstat64(fileno(_f), &file_stat) == 0);
return file_stat.st_size;
#endif
}
void File::close()
{
if ( _f )
{
fclose(_f);
_f = 0;
}
}
void File::printf ( const char* fmt, ... )
{
va_list arg;
int done;
va_start(arg, fmt);
assert(_f);
done = vfprintf ( _f, fmt, arg );
va_end(arg);
}
/*static*/ bool File::LoadIntoString ( std::string& s, const std::string& filename )
{
File in ( filename, "rb" );
if ( !in.isopened() )
return false;
filesize_t flen = in.length();
size_t len = size_t(flen);
if ( len != flen )
return false; // file too big...
s.resize ( len + 1 );
if ( !in.read ( &s[0], len ) )
return false;
s[len] = '\0';
s.resize ( len );
return true;
}
/*static*/ bool File::LoadIntoString ( std::string& s, const std::wstring& filename )
{
File in ( filename, L"rb" );
if ( !in.isopened() )
return false;
filesize_t flen = in.length();
size_t len = size_t(flen);
if ( len != flen )
return false; // file too big...
s.resize ( len + 1 );
if ( !in.read ( &s[0], len ) )
return false;
s[len] = '\0';
s.resize ( len );
return true;
}
/*static*/ bool File::SaveFromString ( const std::string& filename, const std::string& s, bool binary )
{
File out ( filename, binary ? "wb" : "w" );
if ( !out.isopened() )
return false;
out.write ( s.c_str(), s.size() );
return true;
}
/*static*/ bool File::SaveFromString ( const std::wstring& filename, const std::string& s, bool binary )
{
File out ( filename, binary ? L"wb" : L"w" );
if ( !out.isopened() )
return false;
out.write ( s.c_str(), s.size() );
return true;
}
/*static*/ bool File::SaveFromBuffer ( const std::string& filename, const char* buf, size_t buflen, bool binary )
{
File out ( filename, binary ? "wb" : "w" );
if ( !out.isopened() )
return false;
out.write ( buf, buflen );
return true;
}
/*static*/ bool File::SaveFromBuffer ( const std::wstring& filename, const char* buf, size_t buflen, bool binary )
{
File out ( filename, binary ? L"wb" : L"w" );
if ( !out.isopened() )
return false;
out.write ( buf, buflen );
return true;
}
/*static*/ std::string File::TempFileName ( const std::string& prefix )
{
#ifdef WIN32
std::string s ( _tempnam ( ".", prefix.c_str() ) );
return s;
#else
// FIXME
return string("");
#endif
}
/*static*/ std::wstring File::TempFileName ( const std::wstring& prefix )
{
#ifdef WIN32
std::wstring s ( _wtempnam ( L".", prefix.c_str() ) );
return s;
#else
// FIXME
return std::wstring(L"");
#endif
}

View File

@@ -1,173 +0,0 @@
// File.h
// (C) 2002-2004 Royce Mitchell III
// Dually licensed under BSD & LGPL
#ifndef FILE_H
#define FILE_H
#ifdef WIN32
# include <stdio.h> // fgetc
# include <io.h>
#elif defined(UNIX)
# include <sys/stat.h>
# include <unistd.h>
#endif
#include <assert.h>
#include <string>
class File
{
public:
#ifdef WIN32
typedef __int64 fileoff_t;
typedef unsigned __int64 filesize_t;
#else//_MSC_VER
typedef __off64_t fileoff_t;
typedef __size64_t filesize_t;
#endif//_MSC_VER
File() : _f(0)
{
}
File ( const std::string& filename, const char* mode ) : _f(0)
{
open ( filename, mode );
}
File ( const std::wstring& filename, const wchar_t* mode ) : _f(0)
{
open ( filename, mode );
}
File ( const char* filename, const char* mode ) : _f(0)
{
open ( filename, mode );
}
File ( const wchar_t* filename, const wchar_t* mode ) : _f(0)
{
open ( filename, mode );
}
~File()
{
close();
}
bool open ( const std::string& filename, const char* mode )
{
assert ( !_f );
return ( _f = fopen ( filename.c_str(), mode ) ) != 0;
}
bool open ( const std::wstring& filename, const wchar_t* mode )
{
assert ( !_f );
return ( _f = _wfopen ( filename.c_str(), mode ) ) != 0;
}
bool open ( const char* filename, const char* mode )
{
assert ( !_f );
return ( _f = fopen ( filename, mode ) ) != 0;
}
bool open ( const wchar_t* filename, const wchar_t* mode )
{
assert ( !_f );
return ( _f = _wfopen ( filename, mode ) ) != 0;
}
fileoff_t seek ( fileoff_t offset );
int get()
{
return fgetc ( _f );
}
bool put ( int c )
{
return fputc ( c, _f ) != EOF;
}
std::string getline ( bool strip_crlf = false );
std::wstring wgetline ( bool strip_crlf = false );
// this function searches for the next end-of-line and puts all data it
// finds until then in the 'line' parameter.
//
// call continuously until the function returns false ( no more data )
bool next_line ( std::string& line, bool strip_crlf );
bool next_line ( std::wstring& line, bool strip_crlf );
bool read ( void* data, unsigned len )
{
return len == fread ( data, 1, len, _f );
}
bool write ( const void* data, unsigned len )
{
return len == fwrite ( data, 1, len, _f );
}
bool write ( const std::string& data )
{
return data.length() == fwrite ( data.c_str(), 1, data.length(), _f );
}
bool write ( const std::wstring& data )
{
return data.length() == fwrite ( data.c_str(), sizeof(data[0]), data.length(), _f );
}
filesize_t length() const;
void close();
bool isopened() const
{
return _f != 0;
}
bool is_open() const
{
return _f != 0;
}
bool eof() const
{
return feof(_f) ? true : false;
}
FILE* operator * ()
{
return _f;
}
operator FILE*()
{
return _f;
}
void printf ( const char* fmt, ... );
void printf ( const wchar_t* fmt, ... );
static bool LoadIntoString ( std::string& s, const std::string& filename );
static bool LoadIntoString ( std::string& s, const std::wstring& filename );
static bool SaveFromString ( const std::string& filename, const std::string& s, bool binary );
static bool SaveFromString ( const std::wstring& filename, const std::string& s, bool binary );
static bool SaveFromBuffer ( const std::string& filename, const char* buf, size_t buflen, bool binary );
static bool SaveFromBuffer ( const std::wstring& filename, const char* buf, size_t buflen, bool binary );
static std::string TempFileName ( const std::string& prefix );
static std::wstring TempFileName ( const std::wstring& prefix );
private:
File(const File&) {}
const File& operator = ( const File& ) { return *this; }
FILE * _f;
};
#endif//FILE_H

View File

@@ -1,418 +0,0 @@
// IRCClient.cpp
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif//_MSC_VER
#include <vector>
#include <sstream>
#include "IRCClient.h"
#include "MD5.h"
#include "cram_md5.h"
#include "trim.h"
#include "chomp.h"
#include "SplitJoin.h"
#include "base64.h"
#include "config.h"
using std::string;
using std::stringstream;
using std::vector;
bool IRCClient::_debug = true;
// see rfc1459 for IRC-Protocoll Reference
IRCClient::IRCClient()
: _timeout(10*60*1000), _inRun(false)
{
}
bool IRCClient::Connect ( const string& server, short port )
{
string buf;
Close();
Attach ( suTcpSocket() );
if ( !suConnect ( *this, server.c_str(), port ) )
return false;
return true;
}
bool
IRCClient::User ( const string& user, const string& mode,
const string& network, const string& realname )
{
string buf;
buf = "USER " + user + " \"" + mode + "\" \"" + network + "\" :" + realname + "\n";
return Send ( buf );
}
bool
IRCClient::Nick ( const string& nick )
{
_nick = nick;
Send ( "NICK " + _nick + "\n" );
PrivMsg ("NickServ", "IDENTIFY " + (string)PASS);
return true;
}
bool
IRCClient::Mode ( const string& mode )
{
return Send ( "MODE " + _nick + " " + mode + "\n" );
}
bool
IRCClient::Names ( const string& channel )
{
return Send ( "NAMES " + channel + "\n" );
}
bool
IRCClient::Mode ( const string& channel, const string& mode, const string& target )
{
return Send ( "MODE " + channel + " " + mode + " " + target + "\n" );
}
bool
IRCClient::Join ( const string& channel )
{
return Send("JOIN " + channel + "\n");
}
bool
IRCClient::PrivMsg ( const string& to, const string& text )
{
return Send ( "PRIVMSG " + to + " :" + text + '\n' );
}
bool
IRCClient::Action ( const string& to, const string& text )
{
return Send ( "PRIVMSG " + to + " :" + (char)1 + "ACTION " + text + (char)1 + '\n' );
}
bool
IRCClient::Part ( const string& channel, const string& text )
{
return Send ( "PART " + channel + " :" + text + "\n" );
}
bool
IRCClient::Quit ( const string& text )
{
return Send( "QUIT :" + text + "\n");
}
bool IRCClient::_Recv ( string& buf )
{
bool b = (recvUntil ( buf, '\n', _timeout ) > 0);
if ( b && _debug )
{
printf ( ">> %s", buf.c_str() );
if ( buf[buf.length()-1] != '\n' )
printf ( "\n" );
}
return b;
}
bool IRCClient::Send ( const string& buf )
{
if ( _debug )
{
printf ( "<< %s", buf.c_str() );
if ( buf[buf.length()-1] != '\n' )
printf ( "\n" );
}
return ( buf.length() == (size_t)send ( *this, buf.c_str(), buf.length(), 0 ) );
}
bool IRCClient::OnPing( const string& text )
{
return Send( "PONG " + text + "\n" );
}
int THREADAPI IRCClient::Callback ( IRCClient* irc )
{
return irc->Run ( false );
}
int IRCClient::Run ( bool launch_thread )
{
if ( (SOCKET)*this == INVALID_SOCKET )
return 0;
if ( _inRun ) return 1;
if ( launch_thread )
{
ThreadPool::Instance().Launch ( (ThreadPoolFunc*)IRCClient::Callback, this );
return 1;
}
_inRun = true;
if ( _debug ) printf ( "IRCClient::Run() - waiting for responses\n" );
string buf;
while ( _Recv(buf) )
{
if ( !strnicmp ( buf.c_str(), "NOTICE ", 7 ) )
{
//printf ( "recv'd NOTICE msg...\n" );
// TODO...
//OnAuth (
}
else if ( !strnicmp ( buf.c_str(), "PING ", 5 ) )
{
const char* p = &buf[5]; // point to first char after "PING "
while ( *p == ':' ) // then read past the colons
p++;
const char* p2 = strpbrk ( p, "\r\n" ); // find the end of line
string text ( p, p2-p ); // and set the text
OnPing( text );
}
else if ( buf[0] == ':' )
{
const char* p = &buf[1]; // skip first colon...
const char* p2 = strpbrk ( p, " !" );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 0: ", buf.c_str() );
continue;
}
string src ( p, p2-p );
if ( !src.length() )
{
printf ( "!!!:OnRecv failure 0.5: %s", buf.c_str() );
continue;
}
p = p2 + 1;
if ( *p2 == '!' )
{
p2 = strchr ( p, ' ' );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 1: %s", buf.c_str() );
continue;
}
//string srchost ( p, p2-p );
p = p2 + 1;
}
p2 = strchr ( p, ' ' );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 2: %s", buf.c_str() );
continue;
}
string cmd ( p, p2-p );
p = p2 + 1;
p2 = strpbrk ( p, " :" );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 3: %s", buf.c_str() );
continue;
}
string tgt ( p, p2-p );
p = p2 + 1;
p += strspn ( p, " " );
if ( *p == '=' )
{
p++;
p += strspn ( p, " " );
}
if ( *p == ':' )
p++;
p2 = strpbrk ( p, "\r\n" );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 4: %s", buf.c_str() );
continue;
}
string text ( p, p2-p );
strlwr ( &cmd[0] );
if ( cmd == "privmsg" )
{
if ( !tgt.length() )
{
printf ( "!!!:OnRecv failure 5 (PRIVMSG w/o target): %s", buf.c_str() );
continue;
}
if ( *p == 1 )
{
p++;
p2 = strchr ( p, ' ' );
if ( !p2 ) p2 = p + strlen(p);
cmd = string ( p, p2-p );
strlwr ( &cmd[0] );
p = p2 + 1;
p2 = strchr ( p, 1 );
if ( !p2 )
{
printf ( "!!!:OnRecv failure 6 (no terminating \x01 for initial \x01 found: %s", buf.c_str() );
continue;
}
text = string ( p, p2-p );
if ( cmd == "action" )
{
if ( tgt[0] == '#' )
OnChannelAction ( tgt, src, text );
else
OnPrivAction ( src, text );
}
else
{
printf ( "!!!:OnRecv failure 7 (unrecognized \x01 command '%s': %s", cmd.c_str(), buf.c_str() );
continue;
}
}
else
{
if ( tgt[0] == '#' )
OnChannelMsg ( tgt, src, text );
else
OnPrivMsg ( src, text );
}
}
else if ( cmd == "mode" )
{
// two diff. kinds of mode notifications...
//printf ( "[MODE] src='%s' cmd='%s' tgt='%s' text='%s'", src.c_str(), cmd.c_str(), tgt.c_str(), text.c_str() );
//OnMode (
// self mode change:
// [MODE] src=Nick cmd=mode tgt=Nick text=+i
// channel mode change:
// [MODE] src=Nick cmd=mode tgt=#Channel text=+o Nick
if ( tgt[0] == '#' )
{
p = text.c_str();
p2 = strchr ( p, ' ' );
if ( p2 && *p2 )
{
string mode ( p, p2-p );
p = p2 + 1;
p += strspn ( p, " " );
OnUserModeInChannel ( src, tgt, mode, trim(p) );
}
else
OnChannelMode ( tgt, text );
}
else
OnMode ( tgt, text );
}
else if ( cmd == "join" )
{
mychannel = text;
OnJoin ( src, text );
}
else if ( cmd == "part" )
{
OnPart ( src, text );
}
else if ( cmd == "nick" )
{
OnNick ( src, text );
}
else if ( cmd == "kick" )
{
OnKick ();
}
else if ( isdigit(cmd[0]) )
{
int i = atoi(cmd.c_str());
switch ( i )
{
case 1: // "Welcome!" - i.e. it's okay to issue commands now...
OnConnected();
break;
case 353: // user list for channel....
{
p = text.c_str();
p2 = strpbrk ( p, " :" );
if ( !p2 ) continue;
string channel ( p, p2-p );
p = strchr ( p2, ':' );
if ( !p ) continue;
p++;
vector<string> users;
while ( *p )
{
p2 = strchr ( p, ' ' );
if ( !p2 )
p2 = p + strlen(p);
users.push_back ( string ( p, p2-p ) );
p = p2+1;
p += strspn ( p, " " );
}
OnChannelUsers ( channel, users );
}
break;
case 366: // END of user list for channel
{
p = text.c_str();
p2 = strpbrk ( p, " :" );
if ( !p2 ) continue;
string channel ( p, p2-p );
OnEndChannelUsers ( channel );
}
break;
case 474: // You are banned
{
p = text.c_str();
p2 = strpbrk ( p, " :" );
if ( !p2 ) continue;
string channel ( p, p2-p );
OnBanned ( channel );
}
break;
case 433: // Nick in Use
{
string nick = _nick;
Nick (nick + "_");
PrivMsg ("NickServ", "GHOST " + nick + " " + PASS);
// HACK HACK HACK
Mode ( "+i" );
Join ( CHANNEL ); // this is because IRC client does not review if his commands were sucessfull
Sleep ( 1000 );
Nick ( nick );
}
break;
case 2: //MOTD
case 376: //MOTD
case 372:
break;
default:
if ( _debug ) printf ( "unknown command %i: %s", i, buf.c_str() );
break;
}
}
else
{
if ( strstr ( buf.c_str(), "ACTION" ) )
{
printf ( "ACTION: " );
for ( int i = 0; i < buf.size(); i++ )
printf ( "%c(%xh)", buf[i], (unsigned)(unsigned char)buf[i] );
}
else if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
}
}
else
{
if ( _debug ) printf ( "unrecognized irc msg: %s", buf.c_str() );
}
//OnRecv ( buf );
}
if ( _debug ) printf ( "IRCClient::Run() - exiting\n" );
_inRun = false;
return 0;
}

View File

@@ -1,148 +0,0 @@
// IRCClient.h
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef IRCCLIENT_H
#define IRCCLIENT_H
#include <string>
#include <vector>
#include "SockUtils.h"
#include "ThreadPool.h"
class IRCClient : public suBufferedRecvSocket
{
public:
IRCClient();
std::string mychannel;
static bool GetDebug() { return _debug; }
static bool SetDebug ( bool debug ) { bool old = _debug; _debug = debug; return old; }
// connect to server ( record greeting for apop if it exists )
bool Connect ( const std::string& server, short port = 6667 );
bool Running() { return _inRun; }
////////////////////////// IRC Client Protocol commands ///////////////////////
// first thing you must call... mode can be ""
// network can be same as name of server used in Connect() above
bool User ( const std::string& user, const std::string& mode,
const std::string& network, const std::string& realname );
// change nick...
bool Nick ( const std::string& nick );
// change mode for self...
bool Mode ( const std::string& mode );
// set someone's mode in channel ( like oping someone )
bool Mode ( const std::string& channel, const std::string& mode, const std::string& target );
// request a list of names of clients in a channel
bool Names ( const std::string& channel );
// join a channel...
bool Join ( const std::string& channel );
// send message to someone or some channel
bool PrivMsg ( const std::string& to, const std::string& text );
// send /me to someone or some channel
bool Action ( const std::string& to, const std::string& text );
// leave a channel
bool Part ( const std::string& channel, const std::string& text );
// log off
bool Quit ( const std::string& text );
////////////////////// callback functions ////////////////////////////
// OnConnected: you just successfully logged into irc server
virtual bool OnConnected() = 0;
virtual bool OnNick ( const std::string& oldNick, const std::string& newNick ) { return true; }
// OnJoin: someone just successfully joined a channel you are in ( also sent when you successfully join a channel )
virtual bool OnJoin ( const std::string& user, const std::string& channel ) { return true; }
// OnPart: someone just left a channel you are in
virtual bool OnPart ( const std::string& user, const std::string& channel ) { return true; }
// OnPrivMsg: you just received a private message from a user
virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) { return true; }
virtual bool OnPrivAction ( const std::string& from, const std::string& text ) { return true; }
// OnChannelMsg: you just received a chat line in a channel
virtual bool OnChannelMsg ( const std::string& channel, const std::string& from,
const std::string& text ) { return true; }
// OnChannelAction: you just received a "/me" line in a channel
virtual bool OnChannelAction ( const std::string& channel, const std::string& from,
const std::string& text ) { return true; }
// OnChannelMode: notification of a change of a channel's mode
virtual bool OnChannelMode ( const std::string& channel, const std::string& mode )
{ return true; }
// OnUserModeInChannel: notification of a mode change of a user with respect to a channel.
// f.ex.: this will be called when someone is oped in a channel.
virtual bool OnUserModeInChannel ( const std::string& src, const std::string& channel,
const std::string& mode, const std::string& target ) { return true; }
// OnMode: you will receive this when you change your own mode, at least...
virtual bool OnMode ( const std::string& user, const std::string& mode ) { return true; }
// notification of what users are in a channel ( you may get multiple of these... )
virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users )
{ return true; }
// OnKick: if the client has been kicked
virtual bool OnKick ( void ) { return true; }
// OnKick: if the client has been kicked
virtual bool OnBanned ( const std::string& channel ) { return true; }
// notification that you have received the entire list of users for a channel
virtual bool OnEndChannelUsers ( const std::string& channel ) { return true; }
// OnPing - default implementation replies to PING with a valid PONG. required on some systems to
// log in. Most systems require a response in order to stay connected, used to verify a client hasn't
// dropped.
virtual bool OnPing ( const std::string& text );
////////////////////// other functions ////////////////////////////
// this is for sending data to irc server. it's public in case you need to send some
// command not supported by this base class...
bool Send ( const std::string& buf );
// if launch_thread is true, this function will spawn a thread that will process
// incoming packets until the socket dies.
// otherwise ( launch_thread is false ) this function will do that processing
// in *this* thread, and not return until the socket dies.
int Run ( bool launch_thread );
////////////////////// private stuff ////////////////////////////
private:
bool _Recv ( std::string& buf );
static int THREADAPI Callback ( IRCClient* irc );
static bool _debug;
std::string _nick;
int _timeout;
std::string _apop_challenge;
volatile bool _inRun;
// disable copy semantics
IRCClient ( const IRCClient& );
IRCClient& operator = ( const IRCClient& );
};
#endif//IRCCLIENT_H

View File

@@ -1,418 +0,0 @@
// MD5.CPP - RSA Data Security, Inc., MD5 message-digest algorithm
/*
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
//#include <assert.h>
#include <memory.h>
#include <ctype.h>
#include <vector>
#include "MD5.h"
using std::string;
using std::vector;
// Constants for MD5Transform routine.
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static void MD5Transform ( UINT4 [4], const uchar [64] );
static void Encode ( unsigned char *, UINT4 *, unsigned int );
static void Decode ( UINT4 *, const uchar *, unsigned int );
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
// F, G, H and I are basic MD5 functions.
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
// ROTATE_LEFT rotates x left n bits.
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
// Rotation is separate from addition to prevent recomputation.
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
// MD5 initialization. Begins an MD5 operation, writing a new context.
void MD5Init (
MD5_CTX *context ) // context
{
context->count[0] = context->count[1] = 0;
// Load magic initialization constants.
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
// MD5 block update operation. Continues an MD5 message-digest
// operation, processing another message block, and updating the
// context.
void MD5Update (
MD5_CTX *context, // context
const char *input_, // input block
unsigned int inputLen ) // length of input block
{
unsigned int i, index, partLen;
const uchar* input = (const uchar*)input_;
// Compute number of bytes mod 64
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
// Update number of bits
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
// Transform as many times as possible.
if (inputLen >= partLen)
{
memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
// Buffer remaining input
memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}
// MD5 finalization. Ends an MD5 message-digest operation, writing the
// the message digest and zeroizing the context.
void MD5Final (
unsigned char digest[16], // message digest
MD5_CTX *context ) // context
{
uchar bits[8];
unsigned int index, padLen;
// Save number of bits
Encode (bits, context->count, 8);
// Pad out to 56 mod 64.
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, (const char*)PADDING, padLen);
// Append length (before padding)
MD5Update (context, (const char*)bits, 8);
// Store state in digest
Encode (digest, context->state, 16);
// Zeroize sensitive information.
memset ((POINTER)context, 0, sizeof (*context));
}
// MD5 basic transformation. Transforms state based on block.
static void MD5Transform (
UINT4 state[4],
const uchar block[64] )
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
// Round 1
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); // 1
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); // 2
FF (c, d, a, b, x[ 2], S13, 0x242070db); // 3
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); // 4
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); // 5
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); // 6
FF (c, d, a, b, x[ 6], S13, 0xa8304613); // 7
FF (b, c, d, a, x[ 7], S14, 0xfd469501); // 8
FF (a, b, c, d, x[ 8], S11, 0x698098d8); // 9
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); // 10
FF (c, d, a, b, x[10], S13, 0xffff5bb1); // 11
FF (b, c, d, a, x[11], S14, 0x895cd7be); // 12
FF (a, b, c, d, x[12], S11, 0x6b901122); // 13
FF (d, a, b, c, x[13], S12, 0xfd987193); // 14
FF (c, d, a, b, x[14], S13, 0xa679438e); // 15
FF (b, c, d, a, x[15], S14, 0x49b40821); // 16
// Round 2
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); // 17
GG (d, a, b, c, x[ 6], S22, 0xc040b340); // 18
GG (c, d, a, b, x[11], S23, 0x265e5a51); // 19
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); // 20
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); // 21
GG (d, a, b, c, x[10], S22, 0x2441453); // 22
GG (c, d, a, b, x[15], S23, 0xd8a1e681); // 23
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); // 24
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); // 25
GG (d, a, b, c, x[14], S22, 0xc33707d6); // 26
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); // 27
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); // 28
GG (a, b, c, d, x[13], S21, 0xa9e3e905); // 29
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); // 30
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); // 31
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); // 32
// Round 3
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); // 33
HH (d, a, b, c, x[ 8], S32, 0x8771f681); // 34
HH (c, d, a, b, x[11], S33, 0x6d9d6122); // 35
HH (b, c, d, a, x[14], S34, 0xfde5380c); // 36
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); // 37
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); // 38
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); // 39
HH (b, c, d, a, x[10], S34, 0xbebfbc70); // 40
HH (a, b, c, d, x[13], S31, 0x289b7ec6); // 41
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); // 42
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); // 43
HH (b, c, d, a, x[ 6], S34, 0x4881d05); // 44
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); // 45
HH (d, a, b, c, x[12], S32, 0xe6db99e5); // 46
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); // 47
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); // 48
// Round 4
II (a, b, c, d, x[ 0], S41, 0xf4292244); // 49
II (d, a, b, c, x[ 7], S42, 0x432aff97); // 50
II (c, d, a, b, x[14], S43, 0xab9423a7); // 51
II (b, c, d, a, x[ 5], S44, 0xfc93a039); // 52
II (a, b, c, d, x[12], S41, 0x655b59c3); // 53
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); // 54
II (c, d, a, b, x[10], S43, 0xffeff47d); // 55
II (b, c, d, a, x[ 1], S44, 0x85845dd1); // 56
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); // 57
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); // 58
II (c, d, a, b, x[ 6], S43, 0xa3014314); // 59
II (b, c, d, a, x[13], S44, 0x4e0811a1); // 60
II (a, b, c, d, x[ 4], S41, 0xf7537e82); // 61
II (d, a, b, c, x[11], S42, 0xbd3af235); // 62
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); // 63
II (b, c, d, a, x[ 9], S44, 0xeb86d391); // 64
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
// Zeroize sensitive information.
memset ((POINTER)x, 0, sizeof (x));
}
// Encodes input (UINT4) into output (unsigned char). Assumes len is
// a multiple of 4.
static void Encode (
unsigned char *output,
UINT4 *input,
unsigned int len )
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
// Decodes input (unsigned char) into output (UINT4). Assumes len is
// a multiple of 4.
static void Decode (
UINT4 *output,
const uchar *input,
unsigned int len )
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
void digest2ascii ( char *ascii, const unsigned char *digest )
{
int i;
static char* table = "0123456789abcdef";
for ( i = 0; i < 16; i++ )
{
*ascii++ = table[(*digest)>>4];
*ascii++ = table[(*digest++)%16];
}
*ascii++ = 0;
}
void ascii2digest ( unsigned char *digest, const char *ascii )
{
int i;
#define CONV(c) (unsigned char)( (toupper(c)>='A') ? (toupper(c)+10-'A') : ((c)-'0') )
#define MAKECHAR(a,b) ((CONV(a)%16)<<4)|(CONV(b)%16)
for ( i = 0; i < 16; i++ )
{
*digest++ = MAKECHAR(ascii[0],ascii[1]);
ascii += 2;
}
}
#ifdef __cplusplus
MD5::MD5()
{
Init();
}
void MD5::Init()
{
MD5Init(&_ctx);
}
void MD5::Update ( const string& s )
{
MD5Update ( &_ctx, s.c_str(), s.size() );
}
string MD5::Final ( char* digest )
{
vector<uchar> v;
v.resize(16);
MD5Final ( &v[0], &_ctx );
if ( digest )
memmove ( digest, &v[0], 16 );
string s;
static char* tohex = "0123456789abcdef";
for ( int i = 0; i < 16; i++ )
{
uchar c = v[i];
s += tohex[ (c>>4) & 0xF ];
s += tohex[ c & 0xF ];
}
return s;
}
string MD5Hex ( const string& s )
{
MD5 md5;
md5.Update ( s );
return md5.Final();
}
string MD5Bin ( const string& s )
{
MD5 md5;
md5.Update ( s );
char digest[16];
md5.Final ( digest );
return string ( digest, 16 );
}
string HMAC_MD5 ( const string& key, const string& text, char* out_bin )
{
MD5 md5;
char k_ipad[65]; // inner padding - key XORd with ipad
char k_opad[65]; // outer padding - key XORd with opad
string tmp;
char digest[16];
int i;
// if key is longer than 64 bytes reset it to key=MD5(key)
if ( key.length() > 64 )
{
md5.Init();
md5.Update ( key );
md5.Final ( digest );
tmp = string ( digest, 16 );
}
else
tmp = key;
// start out by storing key in pads
memset ( k_ipad, 0, sizeof(k_ipad) );
memset ( k_opad, 0, sizeof(k_opad) );
memcpy ( k_ipad, tmp.c_str(), tmp.length() );
memcpy ( k_opad, tmp.c_str(), tmp.length() );
// XOR key with ipad and opad values
for ( i=0; i<64; i++ )
{
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
// "inner" MD5
md5.Init();
md5.Update(k_ipad);
md5.Update(text);
md5.Final ( digest );
// "outer" MD5
md5.Init();
md5.Update(k_opad);
md5.Update(string(digest,16));
return md5.Final(out_bin);
}
#endif//__cplusplus

View File

@@ -1,95 +0,0 @@
// MD5.H - header file for MD5.CPP
/*
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
#ifndef __MD5_H
#define __MD5_H
#ifdef __cplusplus
#include <string>
#endif//__cplusplus
#ifndef uchar
#define uchar unsigned char
#endif//uchar
#ifndef ushort
#define ushort unsigned short
#endif//ushort
#ifndef ulong
#define ulong unsigned long
#endif//ulong
#ifdef __cplusplus
extern "C" {
#endif//__cplusplus
typedef uchar *POINTER; // POINTER defines a generic pointer type
typedef ushort UINT2; // UINT2 defines a two byte word
typedef ulong UINT4; // UINT4 defines a four byte word
// MD5 context.
typedef struct
{
UINT4 state[4]; // state (ABCD)
UINT4 count[2]; // number of bits, modulo 2^64 (lsb first)
unsigned char buffer[64]; // input buffer
} MD5_CTX;
void MD5Init ( MD5_CTX * );
void MD5Update ( MD5_CTX *, const char *, unsigned int );
void MD5Final ( uchar [16], MD5_CTX * );
void digest2ascii ( char *ascii, const uchar *digest );
void ascii2digest ( uchar *digest, const char *ascii );
#ifdef __cplusplus
} // extern "C"
class MD5
{
public:
MD5();
void Init();
void Update ( const std::string& s );
std::string Final ( char* digest = 0 );
private:
MD5_CTX _ctx;
};
std::string MD5Hex ( const std::string& s );
std::string MD5Bin ( const std::string& s );
std::string HMAC_MD5 (
const std::string& key,
const std::string& text,
char* out_bin = NULL );
#endif//__cplusplus
#endif//__MD5_H

View File

@@ -1,315 +0,0 @@
/*
** Author: Samuel R. Blackburn
** Internet: wfc@pobox.com
**
** You can use it any way you like as long as you don't try to sell it.
**
** Any attempt to sell WFC in source code form must have the permission
** of the original author. You can produce commercial executables with
** WFC but you can't sell WFC.
**
** Copyright, 2000, Samuel R. Blackburn
**
** NOTE: I modified the info block below so it hopefully wouldn't conflict
** with the original file. Royce Mitchell III
*/
#ifndef QUEUET_CLASS_HEADER
#define QUEUET_CLASS_HEADER
#include "ReliMT.h"
#ifdef WIN32
#include <sys/types.h> // off_t
#define HEAPCREATE(size) m_Heap = ::HeapCreate ( HEAP_NO_SERIALIZE, size, 0 )
#define HEAPALLOC(size) ::HeapAlloc ( m_Heap, HEAP_NO_SERIALIZE, size )
#define HEAPREALLOC(p,size) ::HeapReAlloc( m_Heap, HEAP_NO_SERIALIZE, p, size )
#define HEAPFREE(p) ::HeapFree ( m_Heap, HEAP_NO_SERIALIZE, p )
#define HEAPDESTROY() ::HeapDestroy ( m_Heap ); m_Heap = 0;
#else
#define HEAPCREATE(size)
#define HEAPALLOC(size) malloc(size)
#define HEAPREALLOC(p,size) realloc(p,size);
#define HEAPFREE(p) free(p)
#define HEAPDESTROY()
#endif
template <class T>
class CQueueT : public Uncopyable
{
protected:
// What we want to protect
Mutex m_AddMutex;
Mutex m_GetMutex;
T* m_Items;
off_t m_AddIndex;
off_t m_GetIndex;
size_t m_Size;
#ifdef WIN32
HANDLE m_Heap;
#endif//WIN32
inline void m_GrowBy ( size_t number_of_new_items );
public:
inline CQueueT ( size_t initial_size = 1024 );
inline ~CQueueT();
inline bool Add( const T& new_item );
inline void Empty() { m_AddIndex = 0; m_GetIndex = 0; };
inline bool Get( T& item );
inline size_t GetLength() const;
inline size_t GetMaximumLength() const { return( m_Size ); };
inline bool AddArray ( const T* new_items, int item_count );
inline int GetArray ( T* items, const int maxget, const T& tEnd );
inline bool Contains ( const T& t );
};
template <class T>
inline CQueueT<T>::CQueueT ( size_t initial_size )
{
m_AddIndex = 0;
m_GetIndex = 0;
m_Items = NULL;
if ( initial_size == 0 )
initial_size = 1;
/*
** 1999-11-05
** We create our own heap because all of the pointers used are allocated
** and freed be us. We don't have to worry about a non-serialized thread
** accessing something we allocated. Because of this, we can perform our
** memory allocations in a heap dedicated to queueing. This means when we
** have to allocate more memory, we don't have to wait for all other threads
** to pause while we allocate from the shared heap (like the C Runtime heap)
*/
HEAPCREATE( ( ( ( 2 * initial_size * sizeof(T) ) < 65536 ) ? 65536 : (2 * initial_size * sizeof(T) ) ) );
m_Items = (T*)HEAPALLOC ( initial_size * sizeof(T) );
m_Size = ( m_Items == NULL ) ? 0 : initial_size;
}
template <class T>
inline CQueueT<T>::~CQueueT()
{
m_AddIndex = 0;
m_GetIndex = 0;
m_Size = 0;
if ( m_Items != NULL )
{
HEAPFREE(m_Items);
m_Items = NULL;
}
HEAPDESTROY();
}
template <class T>
inline bool CQueueT<T>::Add ( const T& item )
{
// Block other threads from entering Add();
Mutex::Lock addlock ( m_AddMutex );
// Add the item
m_Items[ m_AddIndex ] = item;
// 1999-12-08
// Many many thanks go to Lou Franco (lfranco@spheresoft.com)
// for finding an bug here. It rare but recreatable situations,
// m_AddIndex could be in an invalid state.
// Make sure m_AddIndex is never invalid
off_t new_add_index = ( ( m_AddIndex + 1 ) >= (off_t)m_Size ) ? 0 : m_AddIndex + 1;
if ( new_add_index == m_GetIndex )
{
// The queue is full. We need to grow.
// Stop anyone from getting from the queue
Mutex::Lock getlock ( m_GetMutex );
m_AddIndex = new_add_index;
// One last double-check.
if ( m_AddIndex == m_GetIndex )
{
m_GrowBy ( m_Size );
}
}
else
{
m_AddIndex = new_add_index;
}
return true;
}
template <class T>
inline bool CQueueT<T>::Get( T& item )
{
// Prevent other threads from entering Get()
Mutex::Lock getlock ( m_GetMutex );
if ( m_GetIndex == m_AddIndex )
{
// Let's check to see if our queue has grown too big
// If it has, then shrink it
if ( m_Size > 1024 )
{
// Yup, we're too big for our britches
Mutex::TryLock addlock ( m_AddMutex );
if ( addlock )
{
// Now, no one can add to the queue
if ( m_GetIndex == m_AddIndex ) // is queue empty?
{
// See if we can just shrink it...
T* return_value = (T*)HEAPREALLOC(m_Items,1024 * sizeof(T));
if ( return_value != NULL )
{
m_Items = (T*) return_value;
}
else
{
// Looks like we'll have to do it the hard way
HEAPFREE ( m_Items );
m_Items = (T*) HEAPALLOC ( 1024 * sizeof(T) );
}
m_Size = ( m_Items == NULL ) ? 0 : 1024;
m_AddIndex = 0;
m_GetIndex = 0;
}
else
{
// m_GetIndex != m_AddIndex, this means that someone added
// to the queue between the time we checked m_Size for being
// too big and the time we entered the add critical section.
// If this happened then we are too busy to shrink
}
}
}
return false;
}
item = m_Items[ m_GetIndex ];
// Make sure m_GetIndex is never invalid
m_GetIndex = ( ( m_GetIndex + 1 ) >= (off_t)m_Size ) ? 0 : m_GetIndex + 1;
return true;
}
template <class T>
inline int CQueueT<T>::GetArray ( T* items, const int maxget, const T& tEnd )
{
// TODO - oooh baby does this need to be optimized
// Prevent other threads from entering Get()
Mutex::Lock getlock ( m_GetMutex ); //::EnterCriticalSection( &m_GetCriticalSection );
int iResult = 0;
for ( int i = 0; i < maxget; i++ )
{
if ( !Get(items[i]) )
break;
iResult++;
if ( items[i] == tEnd )
break;
}
// Let other threads call Get() now
//::LeaveCriticalSection( &m_GetCriticalSection );
return iResult;
}
template <class T>
inline size_t CQueueT<T>::GetLength() const
{
// This is a very expensive process!
// No one can call Add() or Get() while we're computing this
size_t number_of_items_in_the_queue = 0;
Mutex::Lock addlock ( m_AddMutex );
Mutex::Lock getlock ( m_GetMutex );
number_of_items_in_the_queue = ( m_AddIndex >= m_GetIndex ) ?
( m_AddIndex - m_GetIndex ) :
( ( m_AddIndex + m_Size ) - m_GetIndex );
return number_of_items_in_the_queue;
}
template <class T>
inline void CQueueT<T>::m_GrowBy ( size_t number_of_new_items )
{
// Prevent other threads from calling Get().
// We don't need to enter the AddCriticalSection because
// m_GrowBy() is only called from Add();
T* new_array = NULL;
T* pointer_to_free = NULL;
size_t new_size = m_Size + number_of_new_items;
{ // Prevent other threads from getting
Mutex::Lock getlock ( m_GetMutex );
// 2000-05-16
// Thanks go to Royce Mitchell III (royce3@aim-controls.com) for finding
// a HUGE bug here. I was using HeapReAlloc as a short cut but my logic
// was flawed. In certain circumstances, queue items were being dropped.
new_array = (T*)HEAPALLOC ( new_size * sizeof(T) );
// Now copy all of the old items from the old queue to the new one.
// Get the entries from the get-index to the end of the array
memcpy ( new_array, &m_Items[m_GetIndex], ( m_Size - m_GetIndex ) * sizeof(T) );
// Get the entries from the beginning of the array to the add-index
memcpy ( &new_array[m_Size-m_GetIndex], m_Items, m_AddIndex * sizeof(T) );
m_AddIndex = (off_t)m_Size;
m_GetIndex = 0;
m_Size = new_size;
pointer_to_free = m_Items;
m_Items = new_array;
} // Mutex::Lock
HEAPFREE ( pointer_to_free );
}
template <class T>
inline bool CQueueT<T>::Contains ( const T& t )
{
Mutex::Lock addlock ( m_AddMutex );
Mutex::Lock getlock ( m_GetMutex );
for ( int i = m_GetIndex; i != m_AddIndex; i++ )
{
if ( i == m_Size )
i = 0;
if ( m_Items[i] == t )
return true;
}
return m_Items[m_AddIndex] == t;
}
typedef CQueueT<char> CCharQueue;
#endif // QUEUE_CLASS_HEADER

View File

@@ -1,143 +0,0 @@
// Reli.h
// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
// The rest is (C) 2002-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef __RELI_H
#define __RELI_H
////////////////////////////////////////////////////////////////////////////////
// Assert
#undef Assert
#ifdef NDEBUG
#define Assert(exp) ((void)0)
#else
void _wassert (char* szExpr, char* szFile, int line);
#define Assert(exp) (void)( (exp) || (_wassert(#exp, __FILE__, __LINE__), 0) )
#endif /* NDEBUG */
////////////////////////////////////////////////////////////////////////////////
// Swap
template <class T>
void Swap(T a,T b)
{
T t = a;
a = b;
b = t;
}
////////////////////////////////////////////////////////////////////////////////
// Uncopyable - base class disabling copy ctors
class Uncopyable
{
public:
Uncopyable(){} // need a default ctor
private:
Uncopyable ( const Uncopyable& );
const Uncopyable& operator = ( const Uncopyable& );
};
////////////////////////////////////////////////////////////////////////////////
// SPtr - Smart Pointer's must be passed by reference or const reference
template <class T>
class SPtr : public Uncopyable
{
public:
virtual ~SPtr () { Destroy(); }
T * operator->() { return _p; }
T const * operator->() const { return _p; }
operator T&() { Assert(_p); return *_p; }
operator const T&() const { Assert(_p); return *_p; }
void Acquire ( SPtr<T>& t ) { Destroy(); Swap(_p,t._p); }
void Destroy() { if ( _p ) { delete _p; _p = 0; } }
protected:
SPtr (): _p (0) {}
explicit SPtr (T* p): _p (p) {}
T * _p;
private:
operator T* () { return _p; }
};
#define DECLARE_SPTR(cls,init,init2) \
class S##cls : public SPtr<cls> \
{ \
public: \
S##cls ( cls* p ) : SPtr<cls>(p) {} \
explicit S##cls init : SPtr<cls> (new cls init2) {} \
};
/* Example Usage of DECLARE_SPTR:
class MyClass
{
public: // can be protected
MyClass ( int i )
{
...
}
...
}; DECLARE_SPTR(MyClass,(int i),(i))
SMyClass ptr(i);
*/
#define DECLARE_SPTRV(cls) typedef SPtr<cls> S##cls;
/* Example Usage of DECLARE_SPTRV:
class MyAbstractClass
{
public: // can be protected
MyAbstractClass ( int i )
{
...
}
void MyPureVirtFunc() = 0;
...
}; DECLARE_SPTRV(MyAbstractClass)
SMyAbstractClass ptr ( new MySubClass(i) );
*/
#define DECLARE_PTR(cls,init,init2) \
class Ptr : public SPtr<cls> \
{ \
Ptr(cls* p) : SPtr<cls> ( p ) \
{ \
} \
Ptr init : SPtr<cls> ( new cls init2 ) {} \
};
/* Example Usage of DECLARE_PTR:
class MyClass
{
DECLARE_PTR(MyClass,(int i),(i))
public: // can be protected
MyClass ( int i )
{
...
}
void MyPureVirtFunc() = 0;
...
};
MyClass::Ptr ptr ( i );
*/
#define DECLARE_PTRV(cls) \
class Ptr : public SPtr<cls> \
{ \
Ptr(cls* p) : SPtr<cls> ( p ) \
{ \
} \
};
/* Example Usage of DECLARE_PTRV:
class MyAbstractClass
{
DECLARE_PTRV(MyAbstractClass)
public: // can be protected
MyAbstractClass ( int i )
{
...
}
void MyPureVirtFunc() = 0;
...
};
MyAbstractClass::Ptr ptr ( new MySubClass(i) );
*/
#endif//__RELI_H

View File

@@ -1,331 +0,0 @@
// ReliMT.cpp
// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
// The rest is (C) 2002-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#include <stdlib.h>
#include <stdio.h>
#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# define snprintf _snprintf
#elif defined(UNIX)
# include <errno.h>
# include <sys/sem.h>
#else
# error unrecognized target
#endif//WIN32|UNIX
#include "verify.h"
#include "ReliMT.h"
////////////////////////////////////////////////////////////////////////////////
// Assert
void _wassert ( char* szExpr, char* szFile, int line )
{
fprintf ( stderr, "Assertion Failure: \"%s\" in file %s, line %d", szExpr, szFile, line );
exit (-1);
}
////////////////////////////////////////////////////////////////////////////////
// Thread
Thread::Thread ( long (THREADAPI * pFun) (void* arg), void* pArg )
{
#ifdef WIN32
verify ( _handle = CreateThread (
0, // Security attributes
0, // Stack size
(DWORD (WINAPI*)(void*))pFun,
pArg,
0, // don't create suspended.
&_tid ));
#elif defined(UNIX)
// set up the thread attribute: right now, we do nothing with it.
pthread_attr_t attr;
pthread_attr_init(&attr);
// this will make the threads created by this process really concurrent
verify ( !pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) );
// create the new OS thread object
verify ( !pthread_create ( &_threadId, &attr, (void* (*) (void*))pFun, pArg ) );
verify ( !pthread_attr_destroy(&attr) );
#else
# error unrecognized target
#endif//WIN32|UNIX
}
Thread::~Thread()
{
#ifdef WIN32
verify ( CloseHandle ( _handle ) );
#elif defined(UNIX)
verify ( !pthread_cancel ( _threadId ) );
#else
# error unrecognized target
#endif//WIN32|UNIX
}
/*void Thread::Resume()
{
#ifdef WIN32
ResumeThread (_handle);
#elif defined(UNIX)
# error how to resume thread in unix?
#else
# error unrecognized target
#endif//WIN32|UNIX
}*/
void Thread::WaitForDeath()
{
#ifdef WIN32
DWORD dw = WaitForSingleObject ( _handle, 2000 );
ASSERT ( dw != WAIT_FAILED );
#elif defined(UNIX)
verify ( !pthread_join ( _threadId, (void**)NULL ) );
#else
# error unrecognized target
#endif//WIN32|UNIX
}
////////////////////////////////////////////////////////////////////////////////
// ActiveObject
// The constructor of the derived class
// should call
// _thread.Resume();
// at the end of construction
ActiveObject::ActiveObject() : _isDying (0), _thread (0)
{
}
ActiveObject::~ActiveObject()
{
ASSERT ( !_thread ); // call Kill() from subclass's dtor
// Kill() - // You can't call a virtual function from a dtor, EVEN INDIRECTLY
// so, you must call Kill() in the subclass's dtor
}
// FlushThread must reset all the events on which the thread might be waiting.
void ActiveObject::Kill()
{
if ( _thread )
{
_isDying++;
FlushThread();
// Let's make sure it's gone
_thread->WaitForDeath();
delete _thread;
_thread = 0;
}
}
void ActiveObject::Start()
{
ASSERT ( !_thread );
_thread = new Thread ( ThreadEntry, this );
}
long THREADAPI ActiveObject::ThreadEntry ( void* pArg )
{
ActiveObject * pActive = (ActiveObject*)pArg;
pActive->InitThread();
pActive->Run();
pActive->Kill();
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Mutex
Mutex::Mutex()
{
#ifdef WIN32
verify ( _h = CreateMutex ( NULL, FALSE, NULL ) );
#elif defined(UNIX)
pthread_mutexattr_t attrib;
verify ( !pthread_mutexattr_init( &attrib ) );
// allow recursive locks
verify ( !pthread_mutexattr_settype( &attrib, PTHREAD_MUTEX_RECURSIVE ) );
verify ( !pthread_mutex_init ( &_mutex, &attrib ) );
#else
# error unrecognized target
#endif
}
Mutex::~Mutex()
{
#ifdef WIN32
verify ( CloseHandle ( _h ) );
#elif defined(UNIX)
verify ( !pthread_mutex_destroy(&_mutex) );
#else
# error unrecognized target
#endif
}
void Mutex::Acquire()
{
#ifdef WIN32
DWORD dw = WaitForSingleObject ( _h, INFINITE );
ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_ABANDONED );
#elif defined(UNIX)
verify ( !pthread_mutex_lock(&_mutex) );
#else
# error unrecognized target
#endif
}
bool Mutex::TryAcquire()
{
#ifdef WIN32
DWORD dw = WaitForSingleObject ( _h, 1 );
ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_TIMEOUT || dw == WAIT_ABANDONED );
return (dw != WAIT_TIMEOUT);
#elif defined(UNIX)
int err = pthread_mutex_trylock(&_mutex);
ASSERT ( err == EBUSY || err == 0 );
return (err == 0);
#else
# error unrecognized target
#endif
}
void Mutex::Release()
{
#ifdef WIN32
verify ( ReleaseMutex ( _h ) );
#elif defined(UNIX)
verify ( !pthread_mutex_unlock(&_mutex) );
// we could allow EPERM return value too, but we are forcing user into RIIA
#else
# error unrecognized target
#endif
}
Mutex::Lock::Lock ( Mutex& m ) : _m(m)
{
_m.Acquire();
}
Mutex::Lock::~Lock()
{
_m.Release();
}
Mutex::TryLock::TryLock ( Mutex& m ) : _m(m)
{
_bLocked = _m.TryAcquire();
}
Mutex::TryLock::~TryLock()
{
if ( _bLocked )
_m.Release();
}
///////////////////////////////////////////////////////////////////////////////
// Event
Event::Event()
{
#ifdef WIN32
// start in non-signaled state (red light)
// auto reset after every Wait
verify ( _handle = CreateEvent ( 0, FALSE, FALSE, 0 ) );
#elif defined(UNIX)
//verify ( !pthread_cond_init ( &_cond, NULL /* default attributes */) );
sem_init();
//verify(sem_init());
#else
# error unrecognized target
#endif
}
Event::~Event()
{
#ifdef WIN32
verify ( CloseHandle ( _handle ) );
#elif defined(UNIX)
//verify ( !pthread_cond_destroy ( &_cond ) );
sem_destroy();
#else
# error unrecognized target
#endif
}
void Event::Release() // put into signaled state
{
#ifdef WIN32
verify ( SetEvent ( _handle ) );
#elif defined(UNIX)
//verify ( !pthread_cond_signal ( &_cond ) );
verify(!sem_V());
#else
# error unrecognized target
#endif
}
void Event::Wait()
{
#ifdef WIN32
// Wait until event is in signaled (green) state
DWORD dw = WaitForSingleObject ( _handle, INFINITE );
ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_ABANDONED );
#elif defined(UNIX)
// According to docs: The pthread_cond_wait() and pthread_cond_timedwait()
// functions are used to block on a condition variable. They are called
// with mutex locked by the calling thread or undefined behaviour will
// result.
//Mutex::Lock lock ( _mutex );
//verify ( !pthread_cond_wait ( &_cond, _mutex ) );
verify(!sem_P());
#else
# error unrecognized target
#endif
}
#ifdef UNIX
void Event::sem_init()
{
sem_id = semget(IPC_PRIVATE, 1, 0666 | IPC_CREAT);
ASSERT(sem_id != -1);
}
int Event::sem_P()
{
struct sembuf sb;
sb.sem_num = 0;
sb.sem_op = -1;
sb.sem_flg = 0;
return semop(sem_id, &sb, 1);
}
int Event::sem_V()
{
struct sembuf sb;
sb.sem_num = 0;
sb.sem_op = 1;
sb.sem_flg = 0;
return semop(sem_id, &sb, 1);
}
void Event::sem_destroy()
{
#ifdef MACOSX
semun mactmp;
mactmp.val = 0;
semctl(sem_id, 0, IPC_RMID, mactmp);
#else
semctl(sem_id, 0, IPC_RMID, 0);
#endif
}
#endif

View File

@@ -1,229 +0,0 @@
// ReliMT.h
// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
// The rest is (C) 2003-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef __RELIMT_H
#define __RELIMT_H
#include "Reli.h"
#ifdef WIN32
# ifndef _WINDOWS_
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# endif
# define THREADAPI WINAPI
#elif defined(UNIX)
# include <pthread.h>
# include <stdlib.h>
# include "string.h"
# include <sys/types.h> //Semaphore
# include <sys/ipc.h> //Semaphore
# include <sys/sem.h> //Semaphore
# define THREADAPI
#else
# error unrecognized target
#endif
////////////////////////////////////////////////////////////////////////////////
// Thread
class Thread : public Uncopyable
{
public:
Thread ( long (THREADAPI * pFun) (void* arg), void* pArg );
~Thread();
//void Resume();
void WaitForDeath();
// platform-specific stuff:
private:
#ifdef WIN32
HANDLE _handle;
DWORD _tid; // thread id
#elif defined(UNIX)
pthread_t _threadId; // id of the thread
#else
# error unrecognized target
#endif
//DECLARE_PTR(Thread,(long (THREADAPI * pFun) (void* arg), void* pArg),(pFun,pArg));
}; //DECLARE_SPTR(Thread,(long (THREADAPI * pFun) (void* arg), void* pArg),(pFun,pArg));
////////////////////////////////////////////////////////////////////////////////
// ActiveObject
class ActiveObject : public Uncopyable
{
public:
ActiveObject();
virtual ~ActiveObject();
void Kill();
void Start();
protected:
virtual void InitThread() = 0;
virtual void Run() = 0;
virtual void FlushThread() = 0;
int _isDying;
static long THREADAPI ThreadEntry ( void *pArg );
Thread *_thread;
//DECLARE_PTRV(ActiveObject);
}; //DECLARE_SPTRV(ActiveObject);
// Last thing in the constructor of a class derived from
// ActiveObject you must call
// Start();
// Inside the loop the Run method you must keep checking _isDying
// if (_isDying)
// return;
// FlushThread must reset all the events on which the thread might be waiting.
// Example:
#if 0
// MyAsyncOutputter - class that outputs strings to a file asynchronously
class MyAsyncOutputter : public ActiveObject
{
public:
MyAsyncOutputter ( const string& filename ) : _filename(filename), _currentBuf(0)
{
Start(); // start thread
}
void InitThread()
{
_f.open ( _filename, "wb" );
}
void Output ( const string& s )
{
{
// acquire lock long enough to add the string to the active buffer
Mutex::Lock lock ( _mutex );
_buf[_currentBuf].push_back ( s );
}
_event.Release(); // don't need the lock fire the event
}
void Run()
{
while ( !_isDying )
{
// wait for signal from Output() or FlushThread()
_event.Wait();
{
// acquire lock long enough to switch active buffers
Mutex::Lock lock ( _mutex );
_currentBuf = 1-_currentBuf;
ASSERT ( !_buf[_currentBuf].size() );
}
// get a reference to the old buffer
vector<string>& buf = _buf[1-_currentBuf];
// write each string out to file and then empty the buffer
for ( int i = 0; i < buf.size(); i++ )
_f.write ( buf[i].c_str(), buf[i].size() );
buf.resize(0);
}
}
void FlushThread()
{
// _isDying is already set: signal thread so it can see that too
_event.Release();
}
private:
string _filename;
File _f;
int _currentBuf;
vector<string> _buf[2];
Event _event;
Mutex _mutex;
};
#endif
////////////////////////////////////////////////////////////////////////////////
// Mutex
class Mutex : public Uncopyable
{
public:
Mutex();
~Mutex();
private:
void Acquire();
bool TryAcquire();
void Release();
public:
// sub-class used to lock the Mutex
class Lock : public Uncopyable
{
public:
Lock ( Mutex& m );
~Lock();
private:
// private data
Mutex& _m;
};
friend class Mutex::Lock;
// sub-class used to attempt to lock the mutex. Use operator bool()
// to test if the lock was successful
class TryLock : public Uncopyable
{
public:
TryLock ( Mutex& m );
~TryLock();
operator bool () { return _bLocked; }
private:
// private data
bool _bLocked;
Mutex& _m;
};
friend class Mutex::TryLock;
private:
// platform-specific stuff:
#ifdef WIN32
HANDLE _h;
#elif defined(UNIX)
pthread_mutex_t _mutex;
public: operator pthread_mutex_t* () { return &_mutex; }
#else
# error unrecognized target
#endif
};
////////////////////////////////////////////////////////////////////////////////
// Event
class Event : public Uncopyable
{
public:
Event();
~Event();
void Release(); // put into signaled state
void Wait();
private:
#ifdef WIN32
HANDLE _handle;
#elif defined(UNIX)
//Sem util functions
void sem_init();
int sem_P();
int sem_V();
void sem_destroy();
int sem_id;
//pthread_cond_t _cond;
//Mutex _mutex;
#else
# error unrecognized target
#endif
//DECLARE_PTR(Event,(),());
}; //DECLARE_SPTR(Event,(),());
#endif//__RELIWIN32_H

View File

@@ -1,504 +0,0 @@
// SockUtils.cpp - Some basic socket utility functions.
// (C) 2002-2004 Royce Mitchell III
// This file is under the BSD & LGPL licenses
#include <stdio.h>
#include "SockUtils.h"
#ifdef WIN32
# ifndef SD_SEND // defined in winsock2.h, but not winsock.h
# define SD_SEND 1
# endif
# define snprintf _snprintf
# ifdef _MSC_VER
# pragma comment ( lib, "ws2_32.lib" )
# endif//_MSC_VER
#elif defined(UNIX)
# include <errno.h>
# include "string.h" // memset
# include <netdb.h> // hostent
# include <arpa/inet.h> //inet_addr
# include <sys/time.h>
# define SD_SEND SHUT_WR //bah thou shalt name thy defines the same
#else
# error unrecognized target
#endif
//// Constants /////////////////////////////////////////////////////////
const int kBufferSize = 1024;
// creates broadcast address
SockAddrIn::SockAddrIn()
{
memset ( this, 0, sizeof(sockaddr_in) );
sin_family = AF_INET;
}
SockAddrIn::SockAddrIn ( const char* szAddr, u_short iPort )
{
memset ( this, 0, sizeof(sockaddr_in) );
sin_family = AF_INET;
sin_addr.s_addr = suLookupAddress(szAddr);
sin_port = htons(iPort);
}
SockAddrIn::SockAddrIn ( in_addr_t iAddr, u_short iPort )
{
memset ( this, 0, sizeof(sockaddr_in) );
sin_family = AF_INET;
sin_addr.s_addr = iAddr;
sin_port = htons(iPort);
}
bool suStartup()
{
#ifdef WIN32
WSADATA wsaData;
if ( WSAStartup ( MAKEWORD(2,0), &wsaData ) )
return false;
if ( wsaData.wVersion != MAKEWORD(2,0) )
{
WSACleanup();
return false;
}
return true;
#elif defined(UNIX)
// nothing special required here
return true;
#else
# error unrecognized target
#endif
}
//// suTcpSocket ////////////////////////////////////////////////
// Creates a TCP socket.
SOCKET suTcpSocket()
{
SOCKET so = socket ( AF_INET, SOCK_STREAM, 0 );
#if defined(_DEBUG) && defined(WIN32)
if ( so == INVALID_SOCKET && WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
return so;
}
//// suUdpSocket ////////////////////////////////////////////////
// Creates a UDP socket. Compensates for new "functionality" introduced
// in Win2K with regards to select() calls
// MS Transport Provider IOCTL to control
// reporting PORT_UNREACHABLE messages
// on UDP sockets via recv/WSARecv/etc.
// Path TRUE in input buffer to enable (default if supported),
// FALSE to disable.
#ifndef SIO_UDP_CONNRESET
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
#endif//SIO_UDP_CONNRESET
SOCKET suUdpSocket()
{
SOCKET so = socket ( AF_INET, SOCK_DGRAM, 0 );
#if defined(_DEBUG) && defined(WIN32)
if ( so == INVALID_SOCKET && WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
#ifdef WIN32
// for Windows 2000, disable new behavior...
// see: http://www-pc.uni-regensburg.de/systemsw/W2KPRO/UPDATE/POSTSP1/Q263823.htm
// this code is innocuous on other win32 platforms
DWORD dwBytesReturned = 0;
BOOL bNewBehavior = FALSE;
// disable new Win2K behavior using
// IOCTL: SIO_UDP_CONNRESET
// we don't care about return value :)
WSAIoctl(so, SIO_UDP_CONNRESET,
&bNewBehavior, sizeof(bNewBehavior),
NULL, 0, &dwBytesReturned,
NULL, NULL);
#endif
return so;
}
//// suShutdownConnection ////////////////////////////////////////////////
// Gracefully shuts the connection sd down. Returns true if it was able
// to shut it down nicely, false if we had to "slam" it shut.
// (either way, the socket does get closed)
bool suShutdownConnection(SOCKET sd)
{
if ( sd == INVALID_SOCKET )
return true;
// Disallow any further data sends. This will tell the other side
// that we want to go away now. If we skip this step, we don't
// shut the connection down nicely.
if (shutdown(sd, SD_SEND) == SOCKET_ERROR)
{
closesocket(sd);
return false;
}
// Receive any extra data still sitting on the socket. After all
// data is received, this call will block until the remote host
// acknowledges the TCP control packet sent by the shutdown above.
// Then we'll get a 0 back from recv, signalling that the remote
// host has closed its side of the connection.
char acReadBuffer[kBufferSize];
for ( ;; )
{
int nNewBytes = recv(sd, acReadBuffer, kBufferSize, 0);
if (nNewBytes == SOCKET_ERROR)
{
closesocket(sd);
return false;
}
else if (nNewBytes != 0)
{
// FYI, received (nNewBytes) unexpected bytes during shutdown.
}
else
{
// Okay, we're done!
break;
}
}
// Close the socket.
if (closesocket(sd) == SOCKET_ERROR)
{
return false;
}
return true;
}
//// suLookupAddress ////////////////////////////////////////////////
// Basically converts a name address to an ip address
in_addr_t suLookupAddress ( const char* pcHost )
{
in_addr_t nRemoteAddr = inet_addr(pcHost);
if ( nRemoteAddr == INADDR_NONE )
{
// pcHost isn't a dotted IP, so resolve it through DNS
hostent* pHE = gethostbyname(pcHost);
if ( pHE == 0 )
{
#if defined(_DEBUG) && defined(WIN32)
if ( WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
return INADDR_NONE;
}
nRemoteAddr = *((in_addr_t*)pHE->h_addr_list[0]);
}
return nRemoteAddr;
}
bool suConnect ( SOCKET so, in_addr_t iAddress, u_short iPort )
{
SockAddrIn sinRemote ( iAddress, iPort );
if ( SOCKET_ERROR == connect(so,sinRemote,sizeof(sinRemote)) )
{
#if defined(_DEBUG) && defined(WIN32)
if ( WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
return false;
}
return true;
}
bool suConnect ( SOCKET so, const char* szAddress, u_short iPort )
{
return suConnect ( so, suLookupAddress(szAddress), iPort );
}
//// suEstablishConnection ////////////////////////////////////////////////
// creates a socket of the specified type, connects to the ip address/port
// requested, and returns the SOCKET created
SOCKET suEstablishConnection ( in_addr_t iAddress, u_short iPort, int type )
{
// Create a socket
if ( type != SOCK_STREAM && type != SOCK_DGRAM )
return INVALID_SOCKET;
SOCKET so = socket(AF_INET, type, 0);
if ( so == INVALID_SOCKET )
return so;
if ( !suConnect(so, iAddress, iPort) )
{
closesocket(so);
return INVALID_SOCKET;
}
return so;
}
//// suEstablishConnection ////////////////////////////////////////////////
// creates a socket of the specified type, connects to the address/port
// requested, and returns the SOCKET created
SOCKET suEstablishConnection ( const char* szAddress, u_short iPort, int type )
{
return suEstablishConnection ( suLookupAddress ( szAddress ), iPort, type );
}
//// suBroadcast ////////////////////////////////////////////////
// takes a previously created broadcast-enabled UDP socket, and broadcasts
// a message on the local network
bool suBroadcast ( SOCKET so, u_short port, const char* buf, int len /* = -1 */ )
{
if ( len == -1 )
len = (int)strlen(buf);
#if 1
SockAddrIn to ( INADDR_BROADCAST, port );
#else // some strange MS OS's don't broadcast to localhost...
SockAddrIn to ( "127.0.0.1", port );
if ( SOCKET_ERROR == sendto ( so, buf, len, 0, to, sizeof(to) ) )
return false;
to.sin_addr.s_addr = INADDR_BROADCAST;
#endif
if ( SOCKET_ERROR == sendto ( so, buf, len, 0, to, sizeof(to) ) )
return false;
return true;
}
//// suRecv ////////////////////////////////////////////////
// retrieves data sent to our TCP socket. If no data, waits for
// a period of timeout ms.
// returns bytes received
// -1 == SOCKET_ERROR
// -2 == timed out waiting for data
int suRecv ( SOCKET so, char* buf, int buflen, int timeout )
{
struct timeval to;
fd_set rread;
int res;
FD_ZERO(&rread); // clear the fd_set
FD_SET(so,&rread); // indicate which socket(s) we want to check
memset((char *)&to,0,sizeof(to)); // clear the timeval struct
to.tv_sec = timeout; // timeout select after (timeout) seconds
// select returns > 0 if there is an event on the socket
res = select((int)so+1, &rread, (fd_set *)0, (fd_set *)0, &to );
if (res < 0)
return -1; // socket error
// there was an event on the socket
if ( (res>0) && (FD_ISSET(so,&rread)) )
return recv ( so, buf, buflen, 0 );
return -2;
}
//// suRecvFrom ////////////////////////////////////////////////
// retrieves data sent to our UDP socket. If no data, waits for
// a period of timeout ms.
// returns bytes received
// returns bytes received
// -1 == SOCKET_ERROR
// -2 == timed out waiting for data
int suRecvFrom ( SOCKET so, char* buf, int buflen, int timeout, sockaddr_in* from, socklen_t* fromlen )
{
struct timeval to;
fd_set rread;
int res;
FD_ZERO(&rread); // clear the fd_set
FD_SET(so,&rread); // indicate which socket(s) we want to check
memset((char *)&to,0,sizeof(to)); // clear the timeval struct
to.tv_sec = timeout; // timeout select after (timeout) seconds
// select returns > 0 if there is an event on the socket
res = select((int)so+1, &rread, (fd_set *)0, (fd_set *)0, &to );
if (res < 0)
return -1; // socket error
// there was an event on the socket
if ( (res>0) && (FD_ISSET(so,&rread)) )
return recvfrom ( so, buf, buflen, 0, (sockaddr*)from, fromlen );
return -2; // timeout
}
//// suBind ////////////////////////////////////////////////
// binds a UDP socket to an interface & port to receive
// data on that port
bool suBind ( SOCKET so, in_addr_t iInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
{
SockAddrIn sinInterface ( iInterfaceAddress, iListenPort );
if ( bReuseAddr )
{
int optval = -1; // true
if ( SOCKET_ERROR == setsockopt ( so, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optval) ) )
{
#if defined(_DEBUG) && defined(WIN32)
if ( WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
return false;
}
}
if ( SOCKET_ERROR == bind(so, sinInterface, sizeof(sinInterface)) )
{
int err = SUERRNO;
if ( err != EADDRINUSE )
return false;
#if defined(_DEBUG) && defined(WIN32)
if ( WSANOTINITIALISED == WSAGetLastError() )
MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
#endif
}
return true;
}
//// suBind ////////////////////////////////////////////////
// binds a UDP socket to an interface & port to receive
// data on that port
bool suBind ( SOCKET so, const char* szInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
{
in_addr_t iInterfaceAddr = inet_addr(szInterfaceAddress);
if ( iInterfaceAddr == INADDR_NONE )
return false;
return suBind ( so, iInterfaceAddr, iListenPort, bReuseAddr );
}
//// suEnableBroadcast ////////////////////////////////////////////////
// in order to send broadcast messages on a UDP socket, this function
// must be called first
bool suEnableBroadcast ( SOCKET so, bool bEnable /* = true */ )
{
int optval = bEnable ? -1 : 0;
if ( SOCKET_ERROR == setsockopt ( so, SOL_SOCKET, SO_BROADCAST, (const char*)&optval, sizeof(optval) ) )
return false;
return true;
}
//// suErrDesc ////////////////////////////////////////////////
// returns text description of error code
const char* suErrDesc ( int err )
{
static char errbuf[256];
#ifdef WIN32
switch ( err )
{
#define X(E) case E: return #E;
X(WSAEINTR) X(WSAEBADF)
X(WSAEACCES) X(WSAEFAULT)
X(WSAEINVAL) X(WSAEMFILE)
X(WSAEWOULDBLOCK) X(WSAEINPROGRESS)
X(WSAEALREADY) X(WSAENOTSOCK)
X(WSAEDESTADDRREQ) X(WSAEMSGSIZE)
X(WSAEPROTOTYPE) X(WSAENOPROTOOPT)
X(WSAEPROTONOSUPPORT) X(WSAESOCKTNOSUPPORT)
X(WSAEOPNOTSUPP) X(WSAEPFNOSUPPORT)
X(WSAEAFNOSUPPORT) X(WSAEADDRINUSE)
X(WSAEADDRNOTAVAIL) X(WSAENETDOWN)
X(WSAENETUNREACH) X(WSAENETRESET)
X(WSAECONNABORTED) X(WSAECONNRESET)
X(WSAENOBUFS) X(WSAEISCONN)
X(WSAENOTCONN) X(WSAESHUTDOWN)
X(WSAETOOMANYREFS) X(WSAETIMEDOUT)
X(WSAECONNREFUSED) X(WSAELOOP)
X(WSAENAMETOOLONG) X(WSAEHOSTDOWN)
X(WSAEHOSTUNREACH) X(WSAENOTEMPTY)
X(WSAEPROCLIM) X(WSAEUSERS)
X(WSAEDQUOT) X(WSAESTALE)
X(WSAEREMOTE) X(WSASYSNOTREADY)
X(WSAVERNOTSUPPORTED) X(WSANOTINITIALISED)
X(WSAEDISCON) X(WSAENOMORE)
X(WSAECANCELLED) X(WSAEINVALIDPROCTABLE)
X(WSAEINVALIDPROVIDER) X(WSAEPROVIDERFAILEDINIT)
X(WSASYSCALLFAILURE) X(WSASERVICE_NOT_FOUND)
X(WSATYPE_NOT_FOUND) X(WSA_E_NO_MORE)
X(WSA_E_CANCELLED) X(WSAEREFUSED)
#undef X
}
snprintf ( errbuf, sizeof(errbuf), "Unknown socket error (%lu)", err );
errbuf[sizeof(errbuf)-1] = '\0';
return errbuf;
#elif defined(UNIX)
perror(errbuf);
return errbuf;
#else
# error unrecognized target
#endif
}
#if defined(UNICODE) || defined(_UNICODE)
in_addr_t suLookupAddress ( const wchar_t* pcHost )
{
int len = wcslen(pcHost);
char* p = new char[len+1];
wcstombs ( p, pcHost, len );
p[len] = 0;
in_addr_t rc = suLookupAddress ( p );
delete[] p;
return rc;
}
bool suBroadcast ( SOCKET so, u_short port, const wchar_t* buf, int len /* = -1 */ )
{
char* p = new char[len+1];
wcstombs ( p, buf, len );
p[len] = 0;
bool rc = suBroadcast ( so, port, p, len );
delete[] p;
return rc;
}
int suRecv ( SOCKET so, wchar_t* buf, int buflen, int timeout )
{
char* p = new char[buflen+1];
int rc = suRecv ( so, p, buflen, timeout );
p[buflen] = 0;
mbstowcs ( buf, p, buflen );
delete[] p;
return rc;
}
int suRecvFrom ( SOCKET so, wchar_t* buf, int buflen, int timeout, sockaddr_in* from, int* fromlen )
{
char* p = new char[buflen+1];
int rc = suRecvFrom ( so, p, buflen, timeout, from, fromlen );
p[buflen] = 0;
mbs2wcs ( buf, p, buflen );
delete[] p;
return rc;
}
bool suBind ( SOCKET so, const wchar_t* szInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
{
int len = wcslen(szInterfaceAddress);
char* p = new char[len+1];
wcstombs ( p, szInterfaceAddress, len );
p[len] = 0;
bool rc = suBind ( so, p, iListenPort, bReuseAddr );
delete[] p;
return rc;
}
#endif//UNICODE
suBufferedRecvSocket::suBufferedRecvSocket ( SOCKET so )
: suSocket ( so ), _off(0), _len(0)
{
}
int suBufferedRecvSocket::recvUntil ( std::string& buf, char until, int timeout )
{
if ( !_len )
_off = 0;
else if ( _off > (sizeof(_buf)>>1) )
{
memmove ( _buf, &_buf[_off], _len );
_off = 0;
}
char* poff = &_buf[_off];
for ( ;; )
{
char* p = (char*)memchr ( poff, until, _len );
if ( p /*&& p < &poff[_len]*/ )
{
int ret_len = p-poff+1;
buf.resize ( ret_len );
memmove ( &buf[0], poff, ret_len );
_off += ret_len;
_len -= ret_len;
return ret_len;
}
int rc = suRecv ( *this, &poff[_len], sizeof(_buf)-_len-_off, timeout );
if ( rc < 0 )
{
if ( _len )
{
rc = _len;
buf.resize ( rc );
memmove ( &buf[0], &_buf[_off], rc );
_len = 0;
}
return rc;
}
_len += rc;
}
}
void suBufferedRecvSocket::recvPending()
{
if ( !_len )
_off = 0;
else if ( _off > (sizeof(_buf)>>1) )
{
memmove ( _buf, &_buf[_off], _len );
_off = 0;
}
char* poff = &_buf[_off];
while ( sizeof(_buf)-_len-_off )
{
int rc = suRecv ( *this, &poff[_len], sizeof(_buf)-_len-_off, 1 );
if ( rc <= 0 )
break;
_len += rc;
}
}
bool suBufferedRecvSocket::recvInStr ( char c )
{
return NULL != memchr ( &_buf[_off], c, _len );
}

View File

@@ -1,132 +0,0 @@
// SockUtils.h - Declarations for the Winsock utility functions module.
// (C) 2002-2004 Royce Mitchell III
// This file is under the BSD & LGPL licenses
#ifndef __SOCKUTILS_H
#define __SOCKUTILS_H
#include <string>
#ifdef WIN32
# include <winsock2.h>
# define in_addr_t u_long
# define SUERRNO WSAGetLastError()
# define EADDRINUSE WSAEADDRINUSE
# define ENOTSOCK WSAENOTSOCK
# define socklen_t int
#elif defined(UNIX)
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <unistd.h>
# include <errno.h>
# define closesocket(so) close(so)
# define SOCKET int
# define INVALID_SOCKET -1
# define SOCKET_ERROR -1
# define SUERRNO errno
# ifdef MACOSX
# define socklen_t int //Stupid mac
# endif
#else
# error unrecognized target
#endif
#include <assert.h>
extern bool suStartup();
extern SOCKET suTcpSocket();
extern SOCKET suUdpSocket();
extern bool suShutdownConnection(SOCKET sd);
extern in_addr_t suLookupAddress ( const char* pcHost );
extern bool suConnect ( SOCKET so, in_addr_t iAddress, u_short iPort );
extern bool suConnect ( SOCKET so, const char* szAddress, u_short iPort );
extern SOCKET suEstablishConnection ( in_addr_t iAddress, u_short iPort, int type );
extern SOCKET suEstablishConnection ( const char* szAddress, u_short iPort, int type );
extern bool suBroadcast ( SOCKET so, u_short port, const char* buf, int len = -1 );
extern int suRecv ( SOCKET so, char* buf, int buflen, int timeout );
extern int suRecvFrom ( SOCKET so, char* buf, int buflen, int timeout, sockaddr_in* from, socklen_t* fromlen );
extern bool suBind ( SOCKET so, in_addr_t iInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
extern bool suBind ( SOCKET so, const char* szInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
extern bool suEnableBroadcast ( SOCKET so, bool bEnable = true );
extern const char* suErrDesc ( int err );
#if defined(UNICODE) || defined(_UNICODE)
extern in_addr_t suLookupAddress ( const wchar_t* pcHost );
extern bool suBroadcast ( SOCKET so, u_short port, const wchar_t* buf, int len = -1 );
extern int suRecv ( SOCKET so, wchar_t* buf, int buflen, int timeout );
extern int suRecvFrom ( SOCKET so, wchar_t* buf, int buflen, int timeout, sockaddr_in* from, int* fromlen );
extern bool suBind ( SOCKET so, const wchar_t* szInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
#endif//UNICODE
class suSocket
{
SOCKET _so;
public:
suSocket ( SOCKET so = INVALID_SOCKET ) : _so(so)
{
}
const suSocket& operator = ( SOCKET so )
{
assert ( _so == INVALID_SOCKET ); // must Detach() or Close() existing socket first
_so = so;
return *this;
}
virtual ~suSocket()
{
Close();
}
void Close()
{
if ( _so != INVALID_SOCKET )
{
//suShutdownConnection ( _so ); // TODO - only valid on TCP sockets
closesocket ( _so );
_so = INVALID_SOCKET;
}
}
operator SOCKET() const
{
return _so;
}
SOCKET Attach ( SOCKET so )
{
SOCKET old = Detach();
_so = so;
return old;
}
SOCKET Detach()
{
SOCKET so = _so;
_so = INVALID_SOCKET;
return so;
}
private:
// disable copy semantics
suSocket ( const suSocket& );
const suSocket& operator = ( const suSocket& );
};
class suBufferedRecvSocket : public suSocket
{
char _buf[2048];
int _off;
int _len;
public:
suBufferedRecvSocket ( SOCKET so = INVALID_SOCKET );
int recvUntil ( std::string& buf, char until, int timeout );
void recvPending();
bool recvInStr ( char c );
};
class SockAddrIn : public sockaddr_in
{
public:
SockAddrIn(); // creates broadcast address
SockAddrIn ( const char* szAddr, u_short iPort );
SockAddrIn ( in_addr_t iAddr, u_short iPort );
operator sockaddr* () { return (sockaddr*)this; }
operator sockaddr_in* () { return (sockaddr_in*)this; }
};
#endif//__SOCKUTILS_H

View File

@@ -1,96 +0,0 @@
// SplitJoin.cpp
//
// This code is copyright 2003-2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifdef _MSC_VER
#pragma warning ( disable : 4786 ) // MSVC6 can't handle too-long template names
#endif//_MSC_VER
//#include <sstream>
#include "SplitJoin.h"
#include <string.h>
using std::string;
using std::vector;
//using std::stringstream;
static const char* quotes = "\"\'";
bool Split ( vector<string>& vec, const char* csv, char sep, bool merge )
{
string scsv ( csv );
char* col = &scsv[0];
vec.resize ( 0 );
for ( ;; )
{
char* p = col;
while ( isspace(*p) && *p != sep )
p++;
char quote = 0;
if ( strchr ( quotes, *p ) )
quote = *p++;
while ( *p && (*p != sep || quote) )
{
if ( *p++ == quote )
break;
}
while ( isspace(*p) && *p != sep )
p++;
if ( *p && *p != sep )
return false;
string scol ( col, p-col );
//quote = scol[0];
if ( quote )
{
if ( scol[scol.size()-1] == quote )
scol = string ( &scol[1], scol.size()-2 );
}
if ( scol.length() || !merge )
vec.push_back ( scol );
if ( !*p )
break;
col = p + 1;
}
return true;
}
bool Join ( string& csv, vector<string>& vec, char sep )
{
csv.resize(0);
for ( int i = 0; i < vec.size(); i++ )
{
if ( i )
csv += sep;
string& s = vec[i];
if ( strchr ( s.c_str(), sep ) )
{
if ( strchr ( s.c_str(), '\"' ) )
{
if ( strchr ( s.c_str(), '\'' ) )
return false; // the sep, " and ' are all in the string, can't build valid output
csv += '\'';
csv += s;
csv += '\'';
}
else
{
csv += '\"';
csv += s;
csv += '\"';
}
}
else
csv += s;
}
return true;
}

View File

@@ -1,32 +0,0 @@
// SplitJoin.h
//
// This code is copyright 2003-2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef SPLITJOIN_H
#define SPLITJOIN_H
#include <vector>
#include <string>
bool Split (
std::vector<std::string>& vec,
const char* csv,
char sep=',',
bool merge=false );
bool Join (
std::string& csv,
std::vector<std::string>& vec,
char sep=',' );
inline bool Split (
std::vector<std::string>& vec,
const std::string& csv,
char sep=',',
bool merge=false )
{
return Split ( vec, csv.c_str(), sep, merge );
}
#endif//SPLIT_H

View File

@@ -1,240 +0,0 @@
// ThreadPool.cpp
// This file is (C) 2003-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#include <vector>
using std::vector;
#include "ThreadPool.h"
#include "QueueT.h"
#include "auto_vector.h"
#include "verify.h"
#include "ReliMT.h"
class PoolableThread : public ActiveObject
{
public:
PoolableThread ( ThreadPoolImpl& );
~PoolableThread()
{
Kill();
}
void InitThread();
void Run();
void FlushThread();
ThreadPoolImpl& _pool;
};
class ThreadPoolLaunchData
{
public:
ThreadPoolFunc* pFun;
void* pArg;
};
template <class T>
class AtomicCounter : public Uncopyable
{
Mutex _m;
T _t;
public:
AtomicCounter ( T init = 0 ) : _t(init)
{
}
AtomicCounter ( const AtomicCounter<T>& t )
{
//Mutex::Lock l ( _m ); // don't need to lock since this is a ctor
Mutex::Lock l2 ( t._m );
_t = t._t;
}
const AtomicCounter<T>& operator = ( const AtomicCounter<T>& t )
{
Mutex::Lock l ( _m );
Mutex::Lock l2 ( t._m );
_t = t._t;
return *this;
}
T operator ++ ()
{
Mutex::Lock l ( _m );
T t = _t++;
return t;
}
const AtomicCounter<T>& operator ++ ( int )
{
Mutex::Lock l ( _m );
++_t;
return *this;
}
T operator -- ()
{
Mutex::Lock l ( _m );
T t = _t--;
return t;
}
const AtomicCounter<T>& operator -- ( int )
{
Mutex::Lock l ( _m );
--_t;
return *this;
}
const AtomicCounter<T>& operator += ( T t )
{
Mutex::Lock l ( _m );
return _t += t;
return *this;
}
const AtomicCounter<T>& operator -= ( T t )
{
Mutex::Lock l ( _m );
return _t -= t;
return *this;
}
operator const T& () const
{
//Mutex::Lock l ( _m );
return _t;
}
T operator !() const
{
//Mutex::Lock l ( _m );
return !_t;
}
};
class ThreadPoolImpl : public Uncopyable
{
public:
ThreadPoolImpl() : _isDying(false), _idleThreads(0)
{
}
~ThreadPoolImpl()
{
}
void Shutdown()
{
_isDying = true;
while ( _idleThreads )
{
_threadWaitEvent.Release();
_threadStartEvent.Wait(); // let thread actually get a grip
}
}
void Launch ( ThreadPoolFunc* pFun, void* pArg )
{
// this mutex is necessary to make sure we never have a conflict
// between checking !_idleThreads and the call to _threadStartEvent.Wait()
// basically if 2 threads call Launch() simultaneously, and there is only
// 1 idle thread, it's possible that a new thread won't be created to
// satisfy the 2nd request until an existing thread finishes.
Mutex::Lock launchlock ( _launchMutex );
ASSERT ( pFun );
ThreadPoolLaunchData* data;
{
Mutex::Lock lock ( _vectorMutex );
if ( !_spareData.size() )
_spareData.push_back ( new ThreadPoolLaunchData() );
data = _spareData.pop_back().release();
if ( !_idleThreads )
_threads.push_back ( new PoolableThread(*this) );
}
data->pFun = pFun;
data->pArg = pArg;
verify ( _pendingData.Add ( data ) );
_threadWaitEvent.Release(); // tell a thread to do it's thing...
_threadStartEvent.Wait(); // wait on a thread to pick up the request
}
// functions for threads to call...
ThreadPoolLaunchData* GetPendingData()
{
ThreadPoolLaunchData* data = NULL;
++_idleThreads;
_threadWaitEvent.Wait(); // waits until there's a request
--_idleThreads;
_threadStartEvent.Release(); // tell requester we got it
if ( _isDying )
return NULL;
_pendingData.Get ( data );
ASSERT ( data );
return data;
}
void RecycleData ( ThreadPoolLaunchData* data )
{
Mutex::Lock lock ( _vectorMutex );
_spareData.push_back ( data );
}
bool _isDying;
Mutex _vectorMutex, _launchMutex;
auto_vector<PoolableThread> _threads;
auto_vector<ThreadPoolLaunchData> _spareData;
CQueueT<ThreadPoolLaunchData*> _pendingData;
Event _threadWaitEvent, _threadStartEvent;
AtomicCounter<int> _idleThreads;
};
///////////////////////////////////////////////////////////////////////////////
// ThreadPool
/*static*/ ThreadPool& ThreadPool::Instance()
{
static ThreadPool tp;
return tp;
}
ThreadPool::ThreadPool() : _pimpl ( new ThreadPoolImpl )
{
};
ThreadPool::~ThreadPool()
{
_pimpl->Shutdown();
delete _pimpl;
_pimpl = 0;
}
void ThreadPool::Launch ( ThreadPoolFunc* pFun, void* pArg )
{
_pimpl->Launch ( pFun, pArg );
}
int ThreadPool::IdleThreads()
{
return _pimpl->_idleThreads;
}
///////////////////////////////////////////////////////////////////////////////
// PoolableThread
PoolableThread::PoolableThread ( ThreadPoolImpl& pool ) : _pool(pool)
{
Start();
}
void PoolableThread::InitThread()
{
}
void PoolableThread::Run()
{
ThreadPoolLaunchData* data;
while ( !_isDying )
{
data = _pool.GetPendingData(); // enter wait state if none...
if ( !data ) // NULL data means kill thread
break;
(*data->pFun) ( data->pArg ); // call the function
_pool.RecycleData ( data );
}
}
void PoolableThread::FlushThread()
{
}

View File

@@ -1,28 +0,0 @@
// ThreadPool.h
// This file is (C) 2003-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef THREADPOOL_H
#define THREADPOOL_H
#include "ReliMT.h"
typedef void THREADAPI ThreadPoolFunc ( void* );
class ThreadPoolImpl;
class ThreadPool : public Uncopyable
{
public:
static ThreadPool& Instance();
~ThreadPool();
void Launch ( ThreadPoolFunc* pFun, void* pArg );
int IdleThreads();
private:
ThreadPool();
ThreadPoolImpl *_pimpl;
};
#endif// THREADPOOL_H

View File

@@ -1,87 +0,0 @@
// auto_ptr.h
// This file is (C) 2002-2003 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef AUTO_PTR_H
#define AUTO_PTR_H
template<class T>
class auto_ptr
{
public:
typedef T element_type;
explicit auto_ptr(T *p = 0) : _p(p)
{
}
auto_ptr(auto_ptr<T>& rhs) : _p(rhs.release())
{
}
auto_ptr<T>& operator=(auto_ptr<T>& rhs)
{
if ( &rhs != this )
{
dispose();
_p = rhs.release();
}
return *this;
}
auto_ptr<T>& set ( auto_ptr<T>& rhs )
{
if ( &rhs != this )
{
dispose();
_p = rhs.release();
}
return *this;
}
~auto_ptr()
{
dispose();
}
void dispose()
{
if ( _p )
{
delete _p;
_p = 0;
}
}
T& operator[] ( int i )
{
return _p[i];
}
T& operator*() const
{
return *_p;
}
T* operator->() const
{
return _p;
}
T* get() const
{
return _p;
}
T* release()
{
T* p = _p;
_p = 0;
return p;
}
private:
T* _p;
};
#endif//AUTO_PTR_H

View File

@@ -1,141 +0,0 @@
// auto_vector.h
// This file is (C) 2002-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef AUTO_VECTOR_H
#define AUTO_VECTOR_H
#include <sys/types.h>
#include "verify.h"
#include "auto_ptr.h"
template<class T>
class auto_vector
{
public:
explicit auto_vector ( size_t capacity = 0 )
: _arr(0), _capacity(0), _end(0)
{
if ( capacity != 0 )
_arr = new auto_ptr<T>[capacity];
_capacity = capacity;
}
~auto_vector()
{
delete []_arr;
}
size_t size() const
{
return _end;
}
const auto_ptr<T>& operator [] ( size_t i ) const
{
ASSERT ( i < _end );
return _arr[i];
}
auto_ptr<T>& operator [] ( size_t i )
{
ASSERT ( i < _end );
return _arr[i];
}
void assign ( size_t i, auto_ptr<T>& p )
{
ASSERT ( i < _end );
_arr[i] = p;
}
void assign_direct ( size_t i, T * p )
{
ASSERT ( i < _end );
reserve ( i + 1 );
_arr[i].reset ( p );
}
void push_back ( auto_ptr<T>& p )
{
reserve ( _end + 1 );
_arr[_end++] = p;
}
auto_ptr<T>& back()
{
ASSERT ( _end != 0 );
return _arr[_end-1];
}
void push_back ( T * p )
{
reserve ( _end + 1 );
auto_ptr<T> tmp(p);
_arr[_end++] = tmp;
//GCC is pedantic, this is an error.
//_arr[_end++] = auto_ptr<T>(p);
}
auto_ptr<T> pop_back()
{
ASSERT ( _end != 0 );
if ( !_end )
{
auto_ptr<T> tmp((T*)0);
return tmp;
//GCC, this is an error.
//return auto_ptr<T>(NULL);
}
return _arr[--_end];
}
void resize ( size_t newSize )
{
ASSERT ( newSize >= 0 );
reserve ( newSize ); // make sure we have at least this much room
_end = newSize;
}
void reserve ( size_t reqCapacity )
{
if ( reqCapacity <= _capacity )
return;
size_t newCapacity = 2 * _capacity;
if ( reqCapacity > newCapacity )
newCapacity = reqCapacity;
// allocate new array
auto_ptr<T> * arrNew = new auto_ptr<T> [newCapacity];
// transfer all entries
for ( size_t i = 0; i < _capacity; ++i )
arrNew[i] = _arr[i];
_capacity = newCapacity;
// free old memory
delete[] _arr;
// substitute new array for old array
_arr = arrNew;
}
void remove ( size_t off )
{
size_t last = _end-1;
if ( off == last )
resize ( last );
else if ( off < last )
{
auto_ptr<T> tmp ( pop_back().release() );
_arr[off] = tmp;
}
}
//typedef const_auto_iterator<T> const_iterator;
//const_iterator begin () const { return _arr; }
//const_iterator end () const { return _arr + _end; }
private:
auto_ptr<T> *_arr;
size_t _capacity;
size_t _end;
};
#endif//AUTO_VECTOR_H

View File

@@ -1,58 +0,0 @@
// base64.cpp
#include "base64.h"
using std::string;
static const char* alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
string base64_encode ( const string& sInput )
{
unsigned char x=0, topbit=0;
int v=0;
string sOutput;
do
{
if ( topbit < 6 )
{
x++;
v <<= 8;
if ( x <= sInput.length() ) v += sInput[x-1];
topbit += 8;
}
topbit -= 6;
if ( x > sInput.length() && !v )
break;
sOutput += alfabet[(v >> topbit) & 63];
v &= (1 << topbit) - 1;
} while ( x < sInput.length() || v );
int eq = (8 - (sOutput.length() % 4)) % 4;
while ( eq-- )
sOutput += '=';
return sOutput;
}
string base64_decode ( const string& sInput )
{
unsigned char x=0, topbit=0;
int v=0, inlen = sInput.length();
string sOutput;
while ( inlen && sInput[inlen-1] == '=' )
inlen--;
do
{
while ( topbit < 8 )
{
x++;
v <<= 6;
if ( x <= inlen ) v += (strchr(alfabet, sInput[x-1]) - alfabet);
topbit += 6;
}
topbit -= 8;
if ( x > inlen && !v )
break;
sOutput += (char)((v >> topbit) & 255);
v &= ((1 << topbit) - 1);
} while ( x <= inlen || v );
return sOutput;
}

View File

@@ -1,12 +0,0 @@
// base64.h
#ifndef BASE64_H
#define BASE64_H
#include <string>
std::string base64_encode ( const std::string& s );
std::string base64_decode ( const std::string& s );
#endif//BASE64_H

View File

@@ -1,15 +0,0 @@
// chomp.cpp
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#include "chomp.h"
std::string chomp ( const std::string& s )
{
const char* p = &s[0];
const char* p2 = &s[0] + s.size();
while ( p2 > p && strchr("\r\n", p2[-1]) )
p2--;
return std::string ( p, p2-p );
}

View File

@@ -1,13 +0,0 @@
// chomp.h
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef CHOMP_H
#define CHOMP_H
#include <string>
std::string chomp ( const std::string& s );
#endif//TRIM_H

View File

@@ -1,7 +0,0 @@
#define SERVER "irc.freenode.net"
#define BOTNAME "ArchBlackmann"
#define CHANNEL "#ReactOS"
#define MODE "+i"
#define PASS "ilovebunnies"

View File

@@ -1,23 +0,0 @@
// cram_md5.cpp
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#include "MD5.h"
#include "cram_md5.h"
#include "base64.h"
using std::string;
string cram_md5 ( const string& username, const string& password, const string& greeting )
{
string challenge = base64_decode ( greeting );
string hmac = HMAC_MD5 ( password, challenge );
//printf ( "(cram_md5): hmac = %s\n", hmac.c_str() );
string raw_response = username;
raw_response += " ";
raw_response += hmac;
//printf ( "(cram_md5): raw_response = %s\n", raw_response.c_str() );
return base64_encode ( raw_response );
}

View File

@@ -1,15 +0,0 @@
// cram_md5.h
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef CRAM_MD5_H
#define CRAM_MD5_H
#include <string>
std::string cram_md5 (
const std::string& username,
const std::string& password,
const std::string& greeting );
#endif//CRAM_MD5_H

View File

@@ -1 +0,0 @@
semprini

View File

@@ -1,10 +0,0 @@
You should have your mouth washed out with soap!
This is a clean channel... please watch your language
Please try to keep it clean
Hey, there's children present ( I'm not even a year old yet! )
Could you find a less-offensive way to express yourself, please?
Such language :(
Those aren't nice words to use
Oh, my poor innocent ears :(
Help! My mind is being corrupted!
filthy mouths are not appreciated here

View File

@@ -1,15 +0,0 @@
Royce3
kjk_hyperion
tamlin
GvG
filip2307
hardon
w3seek
arty
sedwards
Exception
blight_
jimtabor
mtempel
Gge
Alex_Ionescu

View File

@@ -1,580 +0,0 @@
CcCanIWrite
CcCopyRead
CcCopyWrite
CcDeferWrite
CcFastCopyRead
CcFastCopyWrite
CcFlushCache
CcGetDirtyPages
CcGetFileObjectFromBcb
CcGetFileObjectFromSectionPtrs
CcGetFlushedValidData
CcGetLsnForFileObject
CcInitializeCacheMap
CcIsThereDirtyData
CcMapData
CcMdlRead
CcMdlReadComplete
CcMdlWriteAbort
CcMdlWriteComplete
CcPinMappedData
CcPinRead
CcPrepareMdlWrite
CcPreparePinWrite
CcPurgeCacheSection
CcRemapBcb
CcRepinBcb
CcScheduleReadAhead
CcSetAdditionalCacheAttributes
CcSetBcbOwnerPointer
CcSetDirtyPageThreshold
CcSetDirtyPinnedData
CcSetFileSizes
CcSetLogHandleForFile
CcSetReadAheadGranularity
CcUninitializeCacheMap
CcUnpinData
CcUnpinDataForThread
CcUnpinRepinnedBcb
CcWaitForCurrentLazyWriterActivity
CcZeroData
DbgLoadImageSymbols
DbgQueryDebugFilterState
DbgSetDebugFilterState
EVENT_TYPE
ExAcquireResourceExclusive
ExAcquireResourceExclusiveLite
ExAcquireResourceSharedLite
ExAcquireSharedStarveExclusive
ExAcquireSharedWaitForExclusive
ExAllocateFromZone
ExAllocatePool
ExAllocatePoolWithQuota
ExAllocatePoolWithQuotaTag
ExAllocatePoolWithTag
ExConvertExclusiveToSharedLite
ExCreateCallback
ExDeleteNPagedLookasideList
ExDeletePagedLookasideList
ExDeleteResource
ExDeleteResourceLite
ExDisableResourceBoostLite
ExEnumHandleTable
ExExtendZone
ExFreePool
ExGetCurrentProcessorCounts
ExGetCurrentProcessorCpuUsage
ExGetExclusiveWaiterCount
ExGetPreviousMode
ExGetSharedWaiterCount
ExInitializeNPagedLookasideList
ExInitializePagedLookasideList
ExInitializeResource
ExInitializeResourceLite
ExInitializeZone
ExInterlockedAddLargeInteger
ExInterlockedAddUlong
ExInterlockedDecrementLong
ExInterlockedExchangeUlong
ExInterlockedExtendZone
ExInterlockedIncrementLong
ExInterlockedInsertHeadList
ExInterlockedInsertTailList
ExInterlockedPopEntryList
ExInterlockedPushEntryList
ExInterlockedRemoveHeadList
ExIsProcessorFeaturePresent
ExIsResourceAcquiredExclusiveLite
ExIsResourceAcquiredSharedLite
ExLocalTimeToSystemTime
ExNotifyCallback
ExPostSystemEvent
ExQueryPoolBlockSize
ExQueueWorkItem
ExRaiseAccessViolation
ExRaiseDatatypeMisalignment
ExRaiseException
ExRaiseHardError
ExRaiseStatus
ExRegisterCallback
ExReinitializeResourceLite
ExReleaseResource
ExReleaseResourceForThread
ExReleaseResourceForThreadLite
ExRosDumpPagedPoolByTag
ExRosQueryPoolTag
ExSetResourceOwnerPointer
ExSetTimerResolution
ExSystemExceptionFilter
ExSystemTimeToLocalTime
ExTryToAcquireResourceExclusiveLite
ExUnregisterCallback
ExUuidCreate
ExVerifySuite
FsRtlAcquireFileExclusive
FsRtlAddMcbEntry
FsRtlAddToTunnelCache
FsRtlAllocateFileLock
FsRtlAllocatePool
FsRtlAllocatePoolWithQuota
FsRtlAllocatePoolWithQuotaTag
FsRtlAllocatePoolWithTag
FsRtlAllocateResource
FsRtlAreNamesEqual
FsRtlBalanceReads
FsRtlCheckLockForReadAccess
FsRtlCheckLockForWriteAccess
FsRtlCopyRead
FsRtlCopyWrite
FsRtlFastCheckLockForRead
FsRtlFastCheckLockForWrite
FsRtlFastUnlockAll
FsRtlFastUnlockAllByKey
FsRtlFastUnlockSingle
FsRtlFindInTunnelCache
FsRtlFreeFileLock
FsRtlGetFileSize
FsRtlGetNextFileLock
FsRtlGetNextMcbEntry
FsRtlIncrementCcFastReadNoWait
FsRtlIncrementCcFastReadNotPossible
FsRtlIncrementCcFastReadResourceMiss
FsRtlIncrementCcFastReadWait
FsRtlInitializeFileLock
FsRtlInitializeMcb
FsRtlInitializeTunnelCache
FsRtlInsertPerFileObjectContext
FsRtlInsertPerStreamContext
FsRtlIsDbcsInExpression
FsRtlIsFatDbcsLegal
FsRtlIsHpfsDbcsLegal
FsRtlIsNameInExpression
FsRtlLookupLastLargeMcbEntryAndIndex
FsRtlLookupLastMcbEntry
FsRtlLookupMcbEntry
FsRtlLookupPerFileObjectContext
FsRtlLookupPerStreamContextInternal
FsRtlMdlRead
FsRtlMdlReadComplete
FsRtlMdlReadCompleteDev
FsRtlMdlReadDev
FsRtlMdlWriteComplete
FsRtlMdlWriteCompleteDev
FsRtlNotifyChangeDirectory
FsRtlNotifyCleanup
FsRtlNotifyFilterChangeDirectory
FsRtlNotifyFilterReportChange
FsRtlNotifyFullChangeDirectory
FsRtlNotifyFullReportChange
FsRtlNotifyReportChange
FsRtlNotifyUninitializeSync
FsRtlNumberOfRunsInMcb
FsRtlPostPagingFileStackOverflow
FsRtlPostStackOverflow
FsRtlPrepareMdlWrite
FsRtlPrepareMdlWriteDev
FsRtlPrivateLock
FsRtlProcessFileLock
FsRtlRegisterFileSystemFilterCallbacks
FsRtlReleaseFile
FsRtlRemoveMcbEntry
FsRtlRemovePerFileObjectContext
FsRtlRemovePerStreamContext
FsRtlResetLargeMcb
FsRtlSyncVolumes
FsRtlTeardownPerStreamContexts
FsRtlTruncateMcb
FsRtlUninitializeFileLock
FsRtlUninitializeMcb
HalAdjustResourceList
HalAllocateCommonBuffer
HalAssignSlotResources
HalCalibratePerformanceCounter
HalFlushCommonBuffer
HalFreeCommonBuffer
HalGetAdapter
HalGetBusData
HalGetBusDataByOffset
HalGetDmaAlignmentRequirement
HalMakeBeep
HalQueryDisplayParameters
HalQueryRealTimeClock
HalReadDmaCounter
HalRequestIpi
HalSetBusData
HalSetBusDataByOffset
HalSetDisplayParameters
HalSetRealTimeClock
HalStartNextProcessor
IoAcquireCancelSpinLock
IoAcquireRemoveLockEx
IoAcquireVpbSpinLock
IoAllocateAdapterChannel
IoAllocateController
IoAllocateDriverObjectExtension
IoAllocateErrorLogEntry
IoAllocateIrp
IoAllocateMdl
IoAllocateWorkItem
IoAssignResources
IoAttachDevice
IoAttachDeviceByPointer
IoAttachDeviceToDeviceStack
IoAttachDeviceToDeviceStackSafe
IoBuildAsynchronousFsdRequest
IoBuildDeviceIoControlRequest
IoBuildPartialMdl
IoBuildSynchronousFsdRequest
IoCallDriver
IoCancelFileOpen
IoCancelIrp
IoCheckQuerySetFileInformation
IoCheckQuerySetVolumeInformation
IoCheckQuotaBufferValidity
IoCheckShareAccess
IoCompleteRequest
IoConnectInterrupt
IoCreateController
IoCreateDevice
IoCreateDisk
IoCreateDriver
IoCreateFile
IoCreateFileSpecifyDeviceObjectHint
IoCreateNotificationEvent
IoCreateStreamFileObject
IoCreateStreamFileObjectEx
IoCreateStreamFileObjectLite
IoCreateSymbolicLink
IoCreateSynchronizationEvent
IoCreateUnprotectedSymbolicLink
IoDeleteController
IoDeleteDevice
IoDeleteDriver
IoDeleteSymbolicLink
IoDetachDevice
IoDisconnectInterrupt
IoEnqueueIrp
IoEnumerateDeviceObjectList
IoFlushAdapterBuffers
IoForwardIrpSynchronously
IoFreeAdapterChannel
IoFreeController
IoFreeErrorLogEntry
IoFreeIrp
IoFreeMapRegisters
IoFreeMdl
IoFreeWorkItem
IoGetAttachedDevice
IoGetAttachedDeviceReference
IoGetBaseFileSystemDeviceObject
IoGetBootDiskInformation
IoGetConfigurationInformation
IoGetCurrentProcess
IoGetDeviceAttachmentBaseRef
IoGetDeviceInterfaceAlias
IoGetDeviceInterfaces
IoGetDeviceObjectPointer
IoGetDeviceProperty
IoGetDeviceToVerify
IoGetDiskDeviceObject
IoGetDriverObjectExtension
IoGetFileObjectGenericMapping
IoGetInitialStack
IoGetLowerDeviceObject
IoGetRelatedDeviceObject
IoGetRequestorProcess
IoGetRequestorProcessId
IoGetRequestorSessionId
IoGetStackLimits
IoGetTopLevelIrp
IoInitializeIrp
IoInitializeRemoveLockEx
IoInitializeTimer
IoInvalidateDeviceRelations
IoInvalidateDeviceState
IoIsFileOriginRemote
IoIsOperationSynchronous
IoIsSystemThread
IoIsValidNameGraftingBuffer
IoMakeAssociatedIrp
IoMapTransfer
IoOpenDeviceInstanceKey
IoOpenDeviceInterfaceRegistryKey
IoOpenDeviceRegistryKey
IoPageRead
IoPnPDeliverServicePowerNotification
IoQueryDeviceDescription
IoQueryDeviceEnumInfo
IoQueryFileDosDeviceName
IoQueryFileInformation
IoQueryVolumeInformation
IoQueueThreadIrp
IoQueueWorkItem
IoRaiseHardError
IoRaiseInformationalHardError
IoReadDiskSignature
IoReadPartitionTableEx
IoRegisterBootDriverReinitialization
IoRegisterDeviceInterface
IoRegisterDriverReinitialization
IoRegisterFileSystem
IoRegisterFsRegistrationChange
IoRegisterLastChanceShutdownNotification
IoRegisterPlugPlayNotification
IoRegisterShutdownNotification
IoReleaseCancelSpinLock
IoReleaseRemoveLockAndWaitEx
IoReleaseRemoveLockEx
IoReleaseVpbSpinLock
IoRemoveShareAccess
IoReportDetectedDevice
IoReportHalResourceUsage
IoReportResourceForDetection
IoReportResourceUsage
IoReportTargetDeviceChange
IoReportTargetDeviceChangeAsynchronous
IoRequestDeviceEject
IoReuseIrp
IoSetCompletionRoutineEx
IoSetDeviceInterfaceState
IoSetDeviceToVerify
IoSetFileOrigin
IoSetHardErrorOrVerifyDevice
IoSetInformation
IoSetIoCompletion
IoSetPartitionInformationEx
IoSetShareAccess
IoSetStartIoAttributes
IoSetSystemPartition
IoSetThreadHardErrorMode
IoSetTopLevelIrp
IoStartNextPacket
IoStartNextPacketByKey
IoStartPacket
IoStartTimer
IoStopTimer
IoSynchronousInvalidateDeviceRelations
IoSynchronousPageWrite
IoUnregisterFileSystem
IoUnregisterFsRegistrationChange
IoUnregisterPlugPlayNotification
IoUnregisterShutdownNotification
IoUpdateShareAccess
IoValidateDeviceIoControlAccess
IoVerifyPartitionTable
IoVerifyVolume
IoVolumeDeviceToDosName
IoWMIAllocateInstanceIds
IoWMIDeviceObjectToInstanceName
IoWMIExecuteMethod
IoWMIHandleToInstanceName
IoWMIOpenBlock
IoWMIQueryAllData
IoWMIQueryAllDataMultiple
IoWMIQuerySingleInstance
IoWMIQuerySingleInstanceMultiple
IoWMIRegistrationControl
IoWMISetNotificationCallback
IoWMISetSingleInstance
IoWMISetSingleItem
IoWMISuggestInstanceName
IoWMIWriteEvent
IoWriteErrorLogEntry
IoWritePartitionTableEx
KPRIORITY
KdPortGetByte
KdPortPollByte
KdPortPutByte
Ke386QueryIoAccessMap
Ke386SetIoAccessMap
KeAcquireInterruptSpinLock
KeAreApcsDisabled
KeCapturePersistentThreadState
KeDeregisterBugCheckReasonCallback
KeFindConfigurationEntry
KeFindConfigurationNextEntry
KeFlushEntireTb
KeFlushQueuedDpcs
KeGetRecommendedSharedDataAlignment
KeIsExecutingDpc
KeQueryActiveProcessors
KeQueryPerformanceCounter
KeQueryPriorityThread
KeQueryRuntimeThread
KeQuerySystemTime
KeQueryTickCount
KeQueryTimeIncrement
KeRaiseIrql
KeRaiseIrqlToDpcLevel
KeRaiseUserException
KeReadStateEvent
KeRegisterBugCheckCallback
KeRegisterBugCheckReasonCallback
KeReleaseInterruptSpinLock
KeReleaseMutant
KeReleaseMutex
KeReleaseSemaphore
KeReleaseSpinLock
KeReleaseSpinLockFromDpcLevel
KeReleaseSpinLockFromDpcLevel
KeRemoveByKeyDeviceQueue
KeRemoveByKeyDeviceQueueIfBusy
KeRemoveDeviceQueue
KeRemoveEntryDeviceQueue
KeRemoveSystemServiceTable
KeRestoreFloatingPointState
KeRevertToUserAffinityThread
KeRosDumpStackFrames
KeRosGetStackFrames
KeRosPrintAddress
KeSaveFloatingPointState
KeSetDmaIoCoherency
KeSetEvent
KeSetEventBoostPriority
KeSetIdealProcessorThread
KeSetKernelStackSwapEnable
KeSetProfileIrql
KeSetSystemAffinityThread
KeSetTimeIncrement
KeTerminateThread
KeUserModeCallback
KeWaitForMutexObject
KeWaitForSingleObject
KiCoprocessorError
KiUnexpectedInterrupt
LONG
LdrFindResourceDirectory_U
MmAddPhysicalMemory
MmAddVerifierThunks
MmAdjustWorkingSetSize
MmAdvanceMdl
MmAllocateContiguousMemory
MmAllocateContiguousMemorySpecifyCache
MmAllocateMappingAddress
MmAllocateNonCachedMemory
MmBuildMdlForNonPagedPool
MmCanFileBeTruncated
MmCreateMdl
MmCreateSection
MmDbgTranslatePhysicalAddress
MmDisableModifiedWriteOfSection
MmFlushImageSection
MmForceSectionClosed
MmFreeContiguousMemory
MmFreeMappingAddress
MmFreeNonCachedMemory
MmGetPhysicalAddress
MmGetPhysicalMemoryRanges
MmGetSystemRoutineAddress
MmGetVirtualForPhysical
MmGrowKernelStack
MmIsAddressValid
MmIsDriverVerifying
MmIsNonPagedSystemAddressValid
MmIsRecursiveIoFault
MmIsThisAnNtAsSystem
MmIsVerifierEnabled
MmLockPagableDataSection
MmLockPagableImageSection
MmLockPagableSectionByHandle
MmMapIoSpace
MmMapLockedPages
MmMapLockedPagesWithReservedMapping
MmMapMemoryDumpMdl
MmMapUserAddressesToPage
MmMapVideoDisplay
MmMapViewInSessionSpace
MmMapViewInSystemSpace
MmMapViewOfSection
MmMarkPhysicalMemoryAsBad
MmMarkPhysicalMemoryAsGood
MmPageEntireDriver
MmPrefetchPages
MmProbeAndLockPages
MmProbeAndLockProcessPages
MmProbeAndLockSelectedPages
MmProtectMdlSystemAddress
MmQuerySystemSize
MmRemovePhysicalMemory
MmResetDriverPaging
MmSecureVirtualMemory
MmSetAddressRangeModified
MmSetBankedSection
MmSizeOfMdl
MmTrimAllSystemPagableMemory
MmUnlockPagableImageSection
MmUnlockPages
MmUnmapIoSpace
MmUnmapLockedPages
MmUnmapReservedMapping
MmUnmapVideoDisplay
MmUnmapViewInSessionSpace
MmUnmapViewInSystemSpace
MmUnmapViewOfSection
MmUnsecureVirtualMemory
OUT
ObCreateObject
PEJOB
PEPROCESS
PKBUGCHECK_CALLBACK_RECORD
PKDEVICE_QUEUE_ENTRY
PKIRQL
PULONG
PVOID
PW32_THREAD_CALLBACK
PoCallDriver
PoRegisterDeviceForIdleDetection
PoRegisterSystemState
PoRequestPowerIrp
PoSetDeviceBusy
PoSetPowerState
PoSetSystemState
PoStartNextPowerIrp
PoUnregisterSystemState
ProbeForRead
ProbeForWrite
PsAssignImpersonationToken
PsCreateSystemProcess
PsCreateSystemThread
PsGetCurrentProcessId
PsGetCurrentThreadId
PsImpersonateClient
PsReferenceImpersonationToken
PsReferencePrimaryToken
PsRevertThreadToSelf
PsRevertToSelf
PsTerminateSystemThread
READ_PORT_BUFFER_UCHAR
READ_PORT_BUFFER_ULONG
READ_PORT_BUFFER_USHORT
READ_PORT_UCHAR
READ_PORT_ULONG
READ_PORT_USHORT
SeAssignSecurityEx
SeAuditHardLinkCreation
SeAuditingFileEvents
SeAuditingFileEventsWithContext
SeAuditingFileOrGlobalEvents
SeAuditingHardLinkEvents
SeAuditingHardLinkEventsWithContext
SeCaptureSecurityDescriptor
SeCaptureSubjectContext
SeCloseObjectAuditAlarm
SeCreateAccessState
SeCreateClientSecurityFromSubjectContext
SeFilterToken
SeImpersonateClientEx
SePrivilegeObjectAuditAlarm
SeQueryInformationToken
SeQuerySessionIdToken
SeReleaseSecurityDescriptor
SeSetSecurityDescriptorInfoEx
SeTokenIsAdmin
SeTokenIsRestricted
SeTokenIsWriteRestricted
WRITE_PORT_BUFFER_UCHAR
WRITE_PORT_BUFFER_ULONG
WRITE_PORT_BUFFER_USHORT
WRITE_PORT_UCHAR
WRITE_PORT_ULONG
WRITE_PORT_USHORT

View File

@@ -1,10 +0,0 @@
/me bows humbly and begs %s's forgiveness
%s is soo cool... I hope to be like him some day
/me hides in a corner and hopes %s doesn't beat him with the whipping noodle again
/me prostrates at %s's feet and begs his majesty's forgiveness
%s: please don't hurt me!
I'm not worthy... I'm not worthy...
/me sings %s's praises to the world!
/me thinks %s is smarter than %dev%
%s: oh please may I defrag your sock drawer?
/me gives %s a cookie, hoping it will make up for breaking %func% the other day...

View File

@@ -1 +0,0 @@
/me is bored

View File

@@ -1,9 +0,0 @@
PASSIVE_LEVEL
APC_LEVEL
DISPATCH_LEVEL
PROFILE_LEVEL
CLOCK1_LEVEL
IPI_LEVEL
POWER_LEVEL
HIGH_LEVEL
SYNCH_LEVEL

View File

@@ -1,38 +0,0 @@
TARGET := ArchBlackmann.exe
.PHONY: all
all: $(TARGET)
CPP=mingw32-g++
CFLAGS := -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS
LFLAGS :=
LIBS := -lstdc++ -lws2_32
SRCS := ArchBlackmann.cpp \
base64.cpp \
chomp.cpp \
cram_md5.cpp \
File.cpp \
IRCClient.cpp \
MD5.cpp \
panic.cpp \
ReliMT.cpp \
SockUtils.cpp \
SplitJoin.cpp \
ssprintf.cpp \
ThreadPool.cpp \
trim.cpp
OBJS := $(SRCS:.cpp=.o)
$(TARGET): $(OBJS)
$(CPP) $(LFLAGS) -o $@ $(OBJS) $(LIBS)
.cpp.o: $<
$(CPP) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
-@del $(TARGET)
-@del $(OBJS)

View File

@@ -1,13 +0,0 @@
the kernel
ntoskrnl
win32k
msafd
ws2_32
user32
shell32
the cache manager
tdi
the scheduler
the thread queue
the message queue
atapi

View File

@@ -1,5 +0,0 @@
/me slaps %s with a large trout
recycle(%s)
Did I hear something? Musta been a %s-fly... Where's that fly-swatter?
%s: go away son, you bother me....
/me beats %s with the whipping noodle

View File

@@ -1,34 +0,0 @@
// panic.cpp
// This file is (C) 2003-2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef WIN32
#include <conio.h>
#include <windows.h>
#endif//WIN32
#include "panic.h"
void panic ( const char* format, ... )
{
va_list arg;
int done;
va_start(arg, format);
#if defined(WIN32) && !defined(_CONSOLE)
char buf[4096];
_vsnprintf ( buf, sizeof(buf)-1, format, arg );
MessageBox ( NULL, buf, "Panic!", MB_OK|MB_ICONEXCLAMATION );
#else
done = vprintf(format, arg);
printf ( "\n" );
#endif
va_end(arg);
#if defined(WIN32) && defined(_CONSOLE)
printf ( "Press any key to exit\n" );
(void)getch();
#endif//WIN32 && _CONSOLE
exit ( -1 );
}

View File

@@ -1,18 +0,0 @@
// panic.h
// This file is (C) 2003-2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef PANIC_H
#define PANIC_H
void panic ( const char* format, ... );
#define suAssert(expr) if ( !(expr) ) panic ( "%s(%lu): SOCKET ERROR %s\nExpression: %s\n", __FILE__, __LINE__, suErrDesc(SUERRNO), #expr )
#if defined(DEBUG) || defined(_DEBUG)
# define suVerify(expr) suAssert(expr)
#else
# define suVerify(expr) expr
#endif
#endif//PANIC_H

View File

@@ -1,11 +0,0 @@
minute
hour
day
week
fortnight
month
year
decade
century
millenium
eon

View File

@@ -1,44 +0,0 @@
This doc can be also found on the wiki.
ArchBlackman is a IRC-Chat bot of the #reactos irc channel. He has been coded by Royce3 and DrFred (mbosma) currently runs him.
If some one use a swear word he'll tell him not to do so and you can also ask him something technical about reactos. :)
Besides this he also knows some commands. The systax for giving him commands "ArchBlackmann: !grovel". (don't forget to address him)
- !grovel - This is the only command that non ops can do (No Parameter)
- !kiss <person>
- !hug <person>
- !give <someone> <something>
- !say <something> - You can tell him to say something on the channel via PrivateMessage
ArchBlackmann know what he should say from some text files. They can be found on the svn-dir. But can also edit them online if you are op using:
- !add <list> <item>
- !remove <list> <item>
List that are used directly to create responses are:
- tech - here are the sentences ArchBlackmann says when he finds his name
- curse - this are the curses he looks for
- cursecop - this the responces to them
- grovel - this is said when an op does the grovel command
- nogrovel - this when someone else does it
The remaining lists are not used directly, but by the other lists.
They are:
- dev
- func
- irql
- module
- period
- status
- stru
- type
And they are used like this:
/me thinks %s is smarter than %dev%

View File

@@ -1,998 +0,0 @@
// ssprintf.cpp
#include <malloc.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include "ssprintf.h"
#ifdef _MSC_VER
#define alloca _alloca
#endif//_MSC_VER
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
typedef struct {
unsigned int mantissa:23;
unsigned int exponent:8;
unsigned int sign:1;
} ieee_float_t;
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:20;
unsigned int exponent:11;
unsigned int sign:1;
} ieee_double_t;
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:32;
unsigned int exponent:15;
unsigned int sign:1;
unsigned int empty:16;
} ieee_long_double_t;
std::string ssprintf ( const char* fmt, ... )
{
va_list arg;
va_start(arg, fmt);
std::string f = ssvprintf ( fmt, arg );
va_end(arg);
return f;
}
#define ZEROPAD 1 /* pad with zero */
#define SIGN 2 /* unsigned/signed long */
#define PLUS 4 /* show plus */
#define SPACE 8 /* space if plus */
#define LEFT 16 /* left justified */
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
#define ZEROTRUNC 128 /* truncate zero 's */
static int skip_atoi(const char **s)
{
int i=0;
while (isdigit(**s))
i = i*10 + *((*s)++) - '0';
return i;
}
static int do_div(LONGLONG *n,int base)
{
int __res = ((ULONGLONG) *n) % (unsigned) base;
*n = ((ULONGLONG) *n) / (unsigned) base;
return __res;
}
static bool number(std::string& f, LONGLONG num, int base, int size, int precision ,int type)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
if (type & LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++]='0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
precision = i;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
f += ' ';
if (sign)
f += sign;
if (type & SPECIAL)
{
if (base==8)
f += '0';
else if (base==16)
{
f += '0';
f += digits[33];
}
}
if (!(type & LEFT))
{
while (size-- > 0)
f += c;
}
while (i < precision--)
{
f += '0';
}
while (i-- > 0)
{
f += tmp[i];
}
while (size-- > 0)
{
f += ' ';
}
return true;
}
static bool numberf(std::string& f, double __n, char exp_sign, int size, int precision, int type)
{
double exponent = 0.0;
double e;
long ie;
//int x;
char *buf, *tmp;
int i = 0;
int j = 0;
//int k = 0;
double frac, intr;
double p;
char sign;
char c;
char ro = 0;
int result;
union
{
double* __n;
ieee_double_t* n;
} n;
n.__n = &__n;
if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff);
exponent = ie/3.321928;
}
if ( exp_sign == 'g' || exp_sign == 'G' ) {
type |= ZEROTRUNC;
if ( exponent < -4 || fabs(exponent) >= precision )
exp_sign -= 2; // g -> e and G -> E
}
if ( exp_sign == 'e' || exp_sign == 'E' ) {
frac = modf(exponent,&e);
if ( frac > 0.5 )
e++;
else if ( frac < -0.5 )
e--;
result = numberf(f,__n/pow(10.0L,e),'f',size-4, precision, type);
if (result < 0)
return false;
f += exp_sign;
size--;
ie = (long)e;
type = LEFT | PLUS;
if ( ie < 0 )
type |= SIGN;
result = number(f,ie, 10,2, 2,type );
if (result < 0)
return false;
return true;
}
if ( exp_sign == 'f' ) {
buf = (char*)alloca(4096);
if (type & LEFT) {
type &= ~ZEROPAD;
}
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (__n < 0) {
sign = '-';
__n = fabs(__n);
size--;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
frac = modf(__n,&intr);
// # flags forces a . and prevents trucation of trailing zero's
if ( precision > 0 ) {
//frac = modfl(__n,&intr);
i = precision-1;
while ( i >= 0 ) {
frac*=10.0L;
frac = modf(frac, &p);
buf[i] = (int)p + '0';
i--;
}
i = precision;
size -= precision;
ro = 0;
if ( frac > 0.5 ) {
ro = 1;
}
if ( precision >= 1 || type & SPECIAL) {
buf[i++] = '.';
size--;
}
}
if ( intr == 0.0 ) {
buf[i++] = '0';
size--;
}
else {
while ( intr > 0.0 ) {
p = intr;
intr/=10.0L;
modf(intr, &intr);
p -= 10.0*intr;
buf[i++] = (int)p + '0';
size--;
}
}
j = 0;
while ( j < i && ro == 1) {
if ( buf[j] >= '0' && buf[j] <= '8' ) {
buf[j]++;
ro = 0;
}
else if ( buf[j] == '9' ) {
buf[j] = '0';
}
j++;
}
if ( ro == 1 )
buf[i++] = '1';
buf[i] = 0;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
{
while(size-->0)
f += ' ';
}
if (sign)
{
f += sign;
}
if (!(type&(ZEROPAD+LEFT)))
while(size-->0)
{
f += ' ';
}
if (type & SPECIAL) {
}
if (!(type & LEFT))
while (size-- > 0)
{
f += c;
}
tmp = buf;
if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) )
{
j = 0;
while ( j < i && ( *tmp == '0' || *tmp == '.' ))
{
tmp++;
i--;
}
}
// else
// while (i < precision--)
// putc('0', f);
while (i-- > 0)
{
f += tmp[i];
}
while (size-- > 0)
{
f += ' ';
}
}
return true;
}
static bool numberfl(std::string& f, long double __n, char exp_sign, int size, int precision, int type)
{
long double exponent = 0.0;
long double e;
long ie;
//int x;
char *buf, *tmp;
int i = 0;
int j = 0;
//int k = 0;
long double frac, intr;
long double p;
char sign;
char c;
char ro = 0;
int result;
union
{
long double* __n;
ieee_long_double_t* n;
} n;
n.__n = &__n;
if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
ie = ((unsigned int)n.n->exponent - (unsigned int)0x3fff);
exponent = ie/3.321928;
}
if ( exp_sign == 'g' || exp_sign == 'G' ) {
type |= ZEROTRUNC;
if ( exponent < -4 || fabs(exponent) >= precision )
exp_sign -= 2; // g -> e and G -> E
}
if ( exp_sign == 'e' || exp_sign == 'E' ) {
frac = modfl(exponent,&e);
if ( frac > 0.5 )
e++;
else if ( frac < -0.5 )
e--;
result = numberf(f,__n/powl(10.0L,e),'f',size-4, precision, type);
if (result < 0)
return false;
f += exp_sign;
size--;
ie = (long)e;
type = LEFT | PLUS;
if ( ie < 0 )
type |= SIGN;
result = number(f,ie, 10,2, 2,type );
if (result < 0)
return false;
return true;
}
if ( exp_sign == 'f' )
{
buf = (char*)alloca(4096);
if (type & LEFT)
{
type &= ~ZEROPAD;
}
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN)
{
if (__n < 0)
{
sign = '-';
__n = fabs(__n);
size--;
} else if (type & PLUS)
{
sign = '+';
size--;
} else if (type & SPACE)
{
sign = ' ';
size--;
}
}
frac = modfl(__n,&intr);
// # flags forces a . and prevents trucation of trailing zero's
if ( precision > 0 )
{
//frac = modfl(__n,&intr);
i = precision-1;
while ( i >= 0 )
{
frac*=10.0L;
frac = modfl((long double)frac, &p);
buf[i] = (int)p + '0';
i--;
}
i = precision;
size -= precision;
ro = 0;
if ( frac > 0.5 )
{
ro = 1;
}
if ( precision >= 1 || type & SPECIAL)
{
buf[i++] = '.';
size--;
}
}
if ( intr == 0.0 )
{
buf[i++] = '0';
size--;
}
else
{
while ( intr > 0.0 )
{
p=intr;
intr/=10.0L;
modfl(intr, &intr);
p -= 10.0L*intr;
buf[i++] = (int)p + '0';
size--;
}
}
j = 0;
while ( j < i && ro == 1) {
if ( buf[j] >= '0' && buf[j] <= '8' )
{
buf[j]++;
ro = 0;
}
else if ( buf[j] == '9' )
{
buf[j] = '0';
}
j++;
}
if ( ro == 1 )
buf[i++] = '1';
buf[i] = 0;
size -= precision;
if (!(type&(ZEROPAD+LEFT)))
{
while(size-->0)
f += ' ';
}
if (sign)
{
f += sign;
}
if (!(type&(ZEROPAD+LEFT)))
{
while(size-->0)
f += ' ';
}
if (type & SPECIAL) {
}
if (!(type & LEFT))
while (size-- > 0)
{
f += c;
}
tmp = buf;
if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) )
{
j = 0;
while ( j < i && ( *tmp == '0' || *tmp == '.' ))
{
tmp++;
i--;
}
}
// else
// while (i < precision--)
// putc( '0', f);
while (i-- > 0)
{
f += tmp[i];
}
while (size-- > 0)
{
f += ' ';
}
}
return true;
}
static int stringa(std::string& f, const char* s, int len, int field_width, int precision, int flags)
{
int i, done = 0;
if (s == NULL)
{
s = "<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && s[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
f += ' ';
done++;
}
for (i = 0; i < len; ++i)
{
f += *s++;
done++;
}
while (len < field_width--)
{
f += ' ';
done++;
}
return done;
}
static int stringw(std::string& f, const wchar_t* sw, int len, int field_width, int precision, int flags)
{
int i, done = 0;
if (sw == NULL)
{
sw = L"<NULL>";
len = 6;
}
else
{
if (len == -1)
{
len = 0;
while ((unsigned int)len < (unsigned int)precision && sw[len])
len++;
}
else
{
if ((unsigned int)len > (unsigned int)precision)
len = precision;
}
}
if (!(flags & LEFT))
while (len < field_width--)
{
f += ' ';
done++;
}
for (i = 0; i < len; ++i)
{
#define MY_MB_CUR_MAX 1
char mb[MY_MB_CUR_MAX];
int mbcount, j;
mbcount = wctomb(mb, *sw++);
if (mbcount <= 0)
{
break;
}
for (j = 0; j < mbcount; j++)
{
f += mb[j];
done++;
}
}
while (len < field_width--)
{
f += ' ';
done++;
}
return done;
}
#define _isnanl _isnan
#define _finitel _finite
std::string ssvprintf ( const char *fmt, va_list args )
{
ULONGLONG num;
int base;
long double _ldouble;
double _double;
const char *s;
const wchar_t* sw;
int result;
std::string f;
int flags; /* flags to number() */
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier = 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
for (; *fmt ; ++fmt)
{
if (*fmt != '%')
{
f += *fmt;
continue;
}
/* process flags */
flags = 0;
repeat:
++fmt; /* this also skips first '%' */
switch (*fmt) {
case '-': flags |= LEFT; goto repeat;
case '+': flags |= PLUS; goto repeat;
case ' ': flags |= SPACE; goto repeat;
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
/* get field width */
field_width = -1;
if (isdigit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
field_width = va_arg(args, int);
if (field_width < 0) {
field_width = -field_width;
flags |= LEFT;
}
}
/* get the precision */
precision = -1;
if (*fmt == '.') {
++fmt;
if (isdigit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*') {
++fmt;
/* it's the next argument */
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
/* get the conversion qualifier */
qualifier = 0;
// %Z can be just stand alone or as size_t qualifier
if ( *fmt == 'Z' ) {
qualifier = *fmt;
switch ( *(fmt+1)) {
case 'o':
case 'b':
case 'X':
case 'x':
case 'd':
case 'i':
case 'u':
++fmt;
break;
default:
break;
}
} else if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'w') {
qualifier = *fmt;
++fmt;
} else if (*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4') {
qualifier = *fmt;
fmt += 3;
}
// go fine with ll instead of L
if ( *fmt == 'l' ) {
++fmt;
qualifier = 'L';
}
/* default base */
base = 10;
switch (*fmt) {
case 'c':
if (!(flags & LEFT))
while (--field_width > 0)
{
f += ' ';
}
if (qualifier == 'l' || qualifier == 'w')
{
f += (char)(unsigned char)(wchar_t) va_arg(args,int);
}
else
{
f += (char)(unsigned char) va_arg(args,int);
}
while (--field_width > 0)
{
f += ' ';
}
continue;
case 'C':
if (!(flags & LEFT))
while (--field_width > 0)
{
f += ' ';
}
if (qualifier == 'h')
{
f += (char)(unsigned char) va_arg(args,int);
}
else
{
f += (char)(unsigned char)(wchar_t) va_arg(args,int);
}
while (--field_width > 0)
{
f += ' ';
}
continue;
case 's':
if (qualifier == 'l' || qualifier == 'w') {
/* print unicode string */
sw = (const wchar_t*)va_arg(args, wchar_t *);
result = stringw(f, sw, -1, field_width, precision, flags);
} else {
/* print ascii string */
s = va_arg(args, char *);
result = stringa(f, s, -1, field_width, precision, flags);
}
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
continue;
case 'S':
if (qualifier == 'h') {
/* print ascii string */
s = va_arg(args, char *);
result = stringa(f, s, -1, field_width, precision, flags);
} else {
/* print unicode string */
sw = (const wchar_t*)va_arg(args, wchar_t *);
result = stringw(f, sw, -1, field_width, precision, flags);
}
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
continue;
/*case 'Z':
if (qualifier == 'w') {
// print counted unicode string
PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
if ((pus == NULL) || (pus->Buffer == NULL)) {
sw = NULL;
len = -1;
} else {
sw = pus->Buffer;
len = pus->Length / sizeof(WCHAR);
}
result = stringw(f, sw, len, field_width, precision, flags);
} else {
// print counted ascii string
PANSI_STRING pas = va_arg(args, PANSI_STRING);
if ((pas == NULL) || (pas->Buffer == NULL)) {
s = NULL;
len = -1;
} else {
s = pas->Buffer;
len = pas->Length;
}
result = stringa(f, s, -1, field_width, precision, flags);
}
if (result < 0)
return -1;
continue;*/
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
if (qualifier == 'l' || qualifier == 'L' ) {
_ldouble = va_arg(args, long double);
if ( _isnanl(_ldouble) )
{
f += "Nan";
}
else if ( !_finitel(_ldouble) )
{
if ( _ldouble < 0 )
f += "-Inf";
else
f += "+Inf";
} else {
if ( precision == -1 )
precision = 6;
result = numberfl(f,_ldouble,*fmt,field_width,precision,flags);
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
}
} else {
_double = (double)va_arg(args, double);
if ( _isnan(_double) )
{
f += "Nan";
}
else if ( !_finite(_double) )
{
if ( _double < 0 )
f += "-Inf";
else
f += "+Inf";
}
else
{
if ( precision == -1 )
precision = 6;
result = numberf(f,_double,*fmt,field_width,precision,flags);
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
}
}
continue;
case 'p':
if (field_width == -1) {
field_width = 2*sizeof(void *);
flags |= ZEROPAD;
}
result = number(f,
(unsigned long) va_arg(args, void *), 16,
field_width, precision, flags);
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
continue;
case 'n':
if (qualifier == 'l') {
long * ip = va_arg(args, long *);
*ip = 0;
} else {
int * ip = va_arg(args, int *);
*ip = 0;
}
continue;
/* integer number formats - set up the flags and "break" */
case 'o':
base = 8;
break;
case 'b':
base = 2;
break;
case 'X':
flags |= LARGE;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
default:
if (*fmt != '%')
{
f += '%';
}
if (*fmt)
{
f += *fmt;
}
else
--fmt;
continue;
}
if (qualifier == 'I')
num = va_arg(args, ULONGLONG);
else if (qualifier == 'l') {
if (flags & SIGN)
num = va_arg(args, long);
else
num = va_arg(args, unsigned long);
}
else if (qualifier == 'h') {
if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
}
else if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
result = number(f, num, base, field_width, precision, flags);
if (result < 0)
{
assert(!"TODO FIXME handle error better");
return f;
}
}
//putc('\0',f);
return f;
}

View File

@@ -1,12 +0,0 @@
// ssprintf.h
#ifndef SSPRINTF_H
#define SSPRINTF_H
#include <string>
#include <stdarg.h>
std::string ssprintf ( const char* fmt, ... );
std::string ssvprintf ( const char* fmt, va_list args );
#endif//SSPRINTF_H

View File

@@ -1,654 +0,0 @@
RPC_NT_ALREADY_LISTENING
RPC_NT_ALREADY_REGISTERED
RPC_NT_CALL_FAILED
RPC_NT_CALL_FAILED_DNE
RPC_NT_CANT_CREATE_ENDPOINT
RPC_NT_INVALID_BINDING
RPC_NT_INVALID_ENDPOINT_FORMAT
RPC_NT_INVALID_NETWORK_OPTIONS
RPC_NT_INVALID_NET_ADDR
RPC_NT_INVALID_RPC_PROTSEQ
RPC_NT_INVALID_STRING_BINDING
RPC_NT_INVALID_STRING_UUID
RPC_NT_INVALID_TIMEOUT
RPC_NT_NOT_LISTENING
RPC_NT_NO_BINDINGS
RPC_NT_NO_CALL_ACTIVE
RPC_NT_NO_ENDPOINT_FOUND
RPC_NT_NO_PROTSEQS
RPC_NT_NO_PROTSEQS_REGISTERED
RPC_NT_OBJECT_NOT_FOUND
RPC_NT_OUT_OF_RESOURCES
RPC_NT_PROTOCOL_ERROR
RPC_NT_PROTSEQ_NOT_SUPPORTED
RPC_NT_SERVER_TOO_BUSY
RPC_NT_SERVER_UNAVAILABLE
RPC_NT_SS_IN_NULL_CONTEXT
RPC_NT_TYPE_ALREADY_REGISTERED
RPC_NT_UNKNOWN_IF
RPC_NT_UNKNOWN_MGR_TYPE
RPC_NT_WRONG_KIND_OF_BINDING
STATUS_ABANDONED
STATUS_ABANDONED_WAIT_0
STATUS_ABANDONED_WAIT_63
STATUS_ABIOS_INVALID_COMMAND
STATUS_ABIOS_INVALID_LID
STATUS_ABIOS_INVALID_SELECTOR
STATUS_ABIOS_LID_ALREADY_OWNED
STATUS_ABIOS_LID_NOT_EXIST
STATUS_ABIOS_NOT_LID_OWNER
STATUS_ABIOS_NOT_PRESENT
STATUS_ABIOS_SELECTOR_NOT_AVAILABLE
STATUS_ACCESS_DENIED
STATUS_ACCESS_VIOLATION
STATUS_ACCOUNT_DISABLED
STATUS_ACCOUNT_EXPIRED
STATUS_ACCOUNT_LOCKED_OUT
STATUS_ACCOUNT_RESTRICTION
STATUS_ADAPTER_HARDWARE_ERROR
STATUS_ADDRESS_ALREADY_ASSOCIATED
STATUS_ADDRESS_ALREADY_EXISTS
STATUS_ADDRESS_CLOSED
STATUS_ADDRESS_NOT_ASSOCIATED
STATUS_AGENTS_EXHAUSTED
STATUS_ALERTED
STATUS_ALIAS_EXISTS
STATUS_ALLOCATE_BUCKET
STATUS_ALLOTTED_SPACE_EXCEEDED
STATUS_ALREADY_COMMITTED
STATUS_ALREADY_DISCONNECTED
STATUS_ALREADY_WIN32
STATUS_APP_INIT_FAILURE
STATUS_ARBITRATION_UNHANDLED
STATUS_ARRAY_BOUNDS_EXCEEDED
STATUS_AUDIT_FAILED
STATUS_BACKUP_CONTROLLER
STATUS_BAD_COMPRESSION_BUFFER
STATUS_BAD_CURRENT_DIRECTORY
STATUS_BAD_DESCRIPTOR_FORMAT
STATUS_BAD_DEVICE_TYPE
STATUS_BAD_DLL_ENTRYPOINT
STATUS_BAD_FUNCTION_TABLE
STATUS_BAD_IMPERSONATION_LEVEL
STATUS_BAD_INHERITANCE_ACL
STATUS_BAD_INITIAL_PC
STATUS_BAD_INITIAL_STACK
STATUS_BAD_LOGON_SESSION_STATE
STATUS_BAD_MASTER_BOOT_RECORD
STATUS_BAD_NETWORK_NAME
STATUS_BAD_NETWORK_PATH
STATUS_BAD_REMOTE_ADAPTER
STATUS_BAD_SERVICE_ENTRYPOINT
STATUS_BAD_STACK
STATUS_BAD_TOKEN_TYPE
STATUS_BAD_VALIDATION_CLASS
STATUS_BAD_WORKING_SET_LIMIT
STATUS_BEGINNING_OF_MEDIA
STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
STATUS_BREAKPOINT
STATUS_BUFFER_OVERFLOW
STATUS_BUFFER_TOO_SMALL
STATUS_BUS_RESET
STATUS_CANCELLED
STATUS_CANNOT_DELETE
STATUS_CANNOT_IMPERSONATE
STATUS_CANNOT_LOAD_REGISTRY_FILE
STATUS_CANT_ACCESS_DOMAIN_INFO
STATUS_CANT_DISABLE_MANDATORY
STATUS_CANT_OPEN_ANONYMOUS
STATUS_CANT_TERMINATE_SELF
STATUS_CANT_WAIT
STATUS_CARDBUS_NOT_SUPPORTED
STATUS_CHECKING_FILE_SYSTEM
STATUS_CHILD_MUST_BE_VOLATILE
STATUS_CLIENT_SERVER_PARAMETERS_INVALID
STATUS_COMMITMENT_LIMIT
STATUS_CONFLICTING_ADDRESSES
STATUS_CONNECTION_ABORTED
STATUS_CONNECTION_ACTIVE
STATUS_CONNECTION_COUNT_LIMIT
STATUS_CONNECTION_DISCONNECTED
STATUS_CONNECTION_INVALID
STATUS_CONNECTION_IN_USE
STATUS_CONNECTION_REFUSED
STATUS_CONNECTION_RESET
STATUS_CONTROL_C_EXIT
STATUS_CONVERT_TO_LARGE
STATUS_COULD_NOT_INTERPRET
STATUS_CRC_ERROR
STATUS_CTL_FILE_NOT_SUPPORTED
STATUS_DATATYPE_MISALIGNMENT
STATUS_DATA_ERROR
STATUS_DATA_LATE_ERROR
STATUS_DATA_NOT_ACCEPTED
STATUS_DATA_OVERRUN
STATUS_DEBUG_ATTACH_FAILED
STATUS_DELETE_PENDING
STATUS_DEVICE_ALREADY_ATTACHED
STATUS_DEVICE_BUSY
STATUS_DEVICE_CONFIGURATION_ERROR
STATUS_DEVICE_DATA_ERROR
STATUS_DEVICE_DOES_NOT_EXIST
STATUS_DEVICE_NOT_CONNECTED
STATUS_DEVICE_NOT_PARTITIONED
STATUS_DEVICE_NOT_READY
STATUS_DEVICE_OFF_LINE
STATUS_DEVICE_PAPER_EMPTY
STATUS_DEVICE_POWERED_OFF
STATUS_DEVICE_POWER_FAILURE
STATUS_DEVICE_PROTOCOL_ERROR
STATUS_DFS_EXIT_PATH_FOUND
STATUS_DFS_UNAVAILABLE
STATUS_DIRECTORY_NOT_EMPTY
STATUS_DISK_CORRUPT_ERROR
STATUS_DISK_FULL
STATUS_DISK_OPERATION_FAILED
STATUS_DISK_RECALIBRATE_FAILED
STATUS_DISK_RESET_FAILED
STATUS_DLL_INIT_FAILED
STATUS_DLL_INIT_FAILED_LOGOFF
STATUS_DLL_NOT_FOUND
STATUS_DOMAIN_CONTROLLER_NOT_FOUND
STATUS_DOMAIN_CTRLR_CONFIG_ERROR
STATUS_DOMAIN_EXISTS
STATUS_DOMAIN_LIMIT_EXCEEDED
STATUS_DOMAIN_TRUST_INCONSISTENT
STATUS_DRIVER_CANCEL_TIMEOUT
STATUS_DRIVER_ENTRYPOINT_NOT_FOUND
STATUS_DRIVER_INTERNAL_ERROR
STATUS_DRIVER_ORDINAL_NOT_FOUND
STATUS_DRIVER_UNABLE_TO_LOAD
STATUS_DUPLICATE_NAME
STATUS_DUPLICATE_OBJECTID
STATUS_EAS_NOT_SUPPORTED
STATUS_EA_CORRUPT_ERROR
STATUS_EA_LIST_INCONSISTENT
STATUS_EA_TOO_LARGE
STATUS_END_OF_FILE
STATUS_END_OF_MEDIA
STATUS_ENTRYPOINT_NOT_FOUND
STATUS_EOM_OVERFLOW
STATUS_EVALUATION_EXPIRATION
STATUS_EVENTLOG_CANT_START
STATUS_EVENTLOG_FILE_CHANGED
STATUS_EVENTLOG_FILE_CORRUPT
STATUS_EVENT_DONE
STATUS_EVENT_PENDING
STATUS_EXTRANEOUS_INFORMATION
STATUS_FAIL_CHECK
STATUS_FATAL_APP_EXIT
STATUS_FILEMARK_DETECTED
STATUS_FILES_OPEN
STATUS_FILE_CLOSED
STATUS_FILE_CORRUPT_ERROR
STATUS_FILE_DELETED
STATUS_FILE_FORCED_CLOSED
STATUS_FILE_INVALID
STATUS_FILE_IS_A_DIRECTORY
STATUS_FILE_IS_OFFLINE
STATUS_FILE_LOCK_CONFLICT
STATUS_FILE_RENAMED
STATUS_FLOAT_DENORMAL_OPERAND
STATUS_FLOAT_DIVIDE_BY_ZERO
STATUS_FLOAT_INEXACT_RESULT
STATUS_FLOAT_INVALID_OPERATION
STATUS_FLOAT_OVERFLOW
STATUS_FLOAT_STACK_CHECK
STATUS_FLOAT_UNDERFLOW
STATUS_FLOPPY_BAD_REGISTERS
STATUS_FLOPPY_ID_MARK_NOT_FOUND
STATUS_FLOPPY_UNKNOWN_ERROR
STATUS_FLOPPY_VOLUME
STATUS_FLOPPY_WRONG_CYLINDER
STATUS_FOUND_OUT_OF_SCOPE
STATUS_FREE_VM_NOT_AT_BASE
STATUS_FS_DRIVER_REQUIRED
STATUS_FT_MISSING_MEMBER
STATUS_FT_ORPHANING
STATUS_FT_READ_RECOVERING_FROM_BACKUP
STATUS_FT_WRITE_RECOVERY
STATUS_FULLSCREEN_MODE
STATUS_GENERIC_NOT_MAPPED
STATUS_GRACEFUL_DISCONNECT
STATUS_GROUP_EXISTS
STATUS_GUARD_PAGE_VIOLATION
STATUS_GUIDS_EXHAUSTED
STATUS_GUID_SUBSTITUTION_MADE
STATUS_HANDLES_CLOSED
STATUS_HANDLE_NOT_CLOSABLE
STATUS_HOST_UNREACHABLE
STATUS_ILLEGAL_CHARACTER
STATUS_ILLEGAL_DLL_RELOCATION
STATUS_ILLEGAL_FLOAT_CONTEXT
STATUS_ILLEGAL_FUNCTION
STATUS_ILLEGAL_INSTRUCTION
STATUS_ILL_FORMED_PASSWORD
STATUS_ILL_FORMED_SERVICE_ENTRY
STATUS_IMAGE_ALREADY_LOADED
STATUS_IMAGE_CHECKSUM_MISMATCH
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE
STATUS_IMAGE_MP_UP_MISMATCH
STATUS_IMAGE_NOT_AT_BASE
STATUS_INCOMPATIBLE_FILE_MAP
STATUS_INFO_LENGTH_MISMATCH
STATUS_INSTANCE_NOT_AVAILABLE
STATUS_INSTRUCTION_MISALIGNMENT
STATUS_INSUFFICIENT_LOGON_INFO
STATUS_INSUFFICIENT_RESOURCES
STATUS_INSUFF_SERVER_RESOURCES
STATUS_INTEGER_DIVIDE_BY_ZERO
STATUS_INTEGER_OVERFLOW
STATUS_INTERNAL_DB_CORRUPTION
STATUS_INTERNAL_DB_ERROR
STATUS_INTERNAL_ERROR
STATUS_INVALID_ACCOUNT_NAME
STATUS_INVALID_ACL
STATUS_INVALID_ADDRESS
STATUS_INVALID_ADDRESS_COMPONENT
STATUS_INVALID_ADDRESS_WILDCARD
STATUS_INVALID_BLOCK_LENGTH
STATUS_INVALID_BUFFER_SIZE
STATUS_INVALID_CID
STATUS_INVALID_COMPUTER_NAME
STATUS_INVALID_CONNECTION
STATUS_INVALID_DEVICE_REQUEST
STATUS_INVALID_DEVICE_STATE
STATUS_INVALID_DISPOSITION
STATUS_INVALID_DOMAIN_ROLE
STATUS_INVALID_DOMAIN_STATE
STATUS_INVALID_EA_FLAG
STATUS_INVALID_EA_NAME
STATUS_INVALID_FILE_FOR_SECTION
STATUS_INVALID_GROUP_ATTRIBUTES
STATUS_INVALID_HANDLE
STATUS_INVALID_HW_PROFILE
STATUS_INVALID_ID_AUTHORITY
STATUS_INVALID_IMAGE_FORMAT
STATUS_INVALID_IMAGE_LE_FORMAT
STATUS_INVALID_IMAGE_NE_FORMAT
STATUS_INVALID_IMAGE_NOT_MZ
STATUS_INVALID_IMAGE_PROTECT
STATUS_INVALID_IMAGE_WIN_16
STATUS_INVALID_INFO_CLASS
STATUS_INVALID_LDT_DESCRIPTOR
STATUS_INVALID_LDT_OFFSET
STATUS_INVALID_LDT_SIZE
STATUS_INVALID_LEVEL
STATUS_INVALID_LOCK_SEQUENCE
STATUS_INVALID_LOGON_HOURS
STATUS_INVALID_LOGON_TYPE
STATUS_INVALID_MEMBER
STATUS_INVALID_NETWORK_RESPONSE
STATUS_INVALID_OPLOCK_PROTOCOL
STATUS_INVALID_OWNER
STATUS_INVALID_PAGE_PROTECTION
STATUS_INVALID_PARAMETER
STATUS_INVALID_PARAMETER_1
STATUS_INVALID_PARAMETER_10
STATUS_INVALID_PARAMETER_11
STATUS_INVALID_PARAMETER_12
STATUS_INVALID_PARAMETER_2
STATUS_INVALID_PARAMETER_3
STATUS_INVALID_PARAMETER_4
STATUS_INVALID_PARAMETER_5
STATUS_INVALID_PARAMETER_6
STATUS_INVALID_PARAMETER_7
STATUS_INVALID_PARAMETER_8
STATUS_INVALID_PARAMETER_9
STATUS_INVALID_PARAMETER_MIX
STATUS_INVALID_PIPE_STATE
STATUS_INVALID_PLUGPLAY_DEVICE_PATH
STATUS_INVALID_PORT_ATTRIBUTES
STATUS_INVALID_PORT_HANDLE
STATUS_INVALID_PRIMARY_GROUP
STATUS_INVALID_QUOTA_LOWER
STATUS_INVALID_READ_MODE
STATUS_INVALID_SECURITY_DESCR
STATUS_INVALID_SERVER_STATE
STATUS_INVALID_SID
STATUS_INVALID_SUB_AUTHORITY
STATUS_INVALID_SYSTEM_SERVICE
STATUS_INVALID_UNWIND_TARGET
STATUS_INVALID_USER_BUFFER
STATUS_INVALID_VARIANT
STATUS_INVALID_VIEW_SIZE
STATUS_INVALID_VLM_OPERATION
STATUS_INVALID_VOLUME_LABEL
STATUS_INVALID_WORKSTATION
STATUS_IN_PAGE_ERROR
STATUS_IO_DEVICE_ERROR
STATUS_IO_PRIVILEGE_FAILED
STATUS_IO_REPARSE_DATA_INVALID
STATUS_IO_REPARSE_TAG_INVALID
STATUS_IO_REPARSE_TAG_MISMATCH
STATUS_IO_REPARSE_TAG_NOT_HANDLED
STATUS_IO_TIMEOUT
STATUS_IP_ADDRESS_CONFLICT1
STATUS_IP_ADDRESS_CONFLICT2
STATUS_KERNEL_APC
STATUS_KEY_DELETED
STATUS_KEY_HAS_CHILDREN
STATUS_LAST_ADMIN
STATUS_LICENSE_QUOTA_EXCEEDED
STATUS_LICENSE_VIOLATION
STATUS_LINK_FAILED
STATUS_LINK_TIMEOUT
STATUS_LM_CROSS_ENCRYPTION_REQUIRED
STATUS_LOCAL_DISCONNECT
STATUS_LOCAL_USER_SESSION_KEY
STATUS_LOCK_NOT_GRANTED
STATUS_LOGIN_TIME_RESTRICTION
STATUS_LOGIN_WKSTA_RESTRICTION
STATUS_LOGON_FAILURE
STATUS_LOGON_NOT_GRANTED
STATUS_LOGON_SERVER_CONFLICT
STATUS_LOGON_SESSION_COLLISION
STATUS_LOGON_SESSION_EXISTS
STATUS_LOGON_TYPE_NOT_GRANTED
STATUS_LOG_FILE_FULL
STATUS_LOG_HARD_ERROR
STATUS_LONGJUMP
STATUS_LOST_WRITEBEHIND_DATA
STATUS_LPC_REPLY_LOST
STATUS_LUIDS_EXHAUSTED
STATUS_MAPPED_ALIGNMENT
STATUS_MAPPED_FILE_SIZE_ZERO
STATUS_MARSHALL_OVERFLOW
STATUS_MEDIA_CHANGED
STATUS_MEDIA_CHECK
STATUS_MEDIA_WRITE_PROTECTED
STATUS_MEMBERS_PRIMARY_GROUP
STATUS_MEMBER_IN_ALIAS
STATUS_MEMBER_IN_GROUP
STATUS_MEMBER_NOT_IN_ALIAS
STATUS_MEMBER_NOT_IN_GROUP
STATUS_MEMORY_NOT_ALLOCATED
STATUS_MESSAGE_NOT_FOUND
STATUS_MISSING_SYSTEMFILE
STATUS_MORE_ENTRIES
STATUS_MORE_PROCESSING_REQUIRED
STATUS_MUTANT_LIMIT_EXCEEDED
STATUS_MUTANT_NOT_OWNED
STATUS_NAME_TOO_LONG
STATUS_NETLOGON_NOT_STARTED
STATUS_NETWORK_ACCESS_DENIED
STATUS_NETWORK_BUSY
STATUS_NETWORK_CREDENTIAL_CONFLICT
STATUS_NETWORK_NAME_DELETED
STATUS_NETWORK_UNREACHABLE
STATUS_NET_WRITE_FAULT
STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
STATUS_NONCONTINUABLE_EXCEPTION
STATUS_NONEXISTENT_EA_ENTRY
STATUS_NONEXISTENT_SECTOR
STATUS_NONE_MAPPED
STATUS_NOTIFY_CLEANUP
STATUS_NOTIFY_ENUM_DIR
STATUS_NOT_ALL_ASSIGNED
STATUS_NOT_A_DIRECTORY
STATUS_NOT_A_REPARSE_POINT
STATUS_NOT_CLIENT_SESSION
STATUS_NOT_COMMITTED
STATUS_NOT_FOUND
STATUS_NOT_IMPLEMENTED
STATUS_NOT_LOCKED
STATUS_NOT_LOGON_PROCESS
STATUS_NOT_MAPPED_DATA
STATUS_NOT_MAPPED_VIEW
STATUS_NOT_REGISTRY_FILE
STATUS_NOT_SAME_DEVICE
STATUS_NOT_SERVER_SESSION
STATUS_NOT_SUPPORTED
STATUS_NOT_TINY_STREAM
STATUS_NO_BROWSER_SERVERS_FOUND
STATUS_NO_CALLBACK_ACTIVE
STATUS_NO_DATA_DETECTED
STATUS_NO_EAS_ON_FILE
STATUS_NO_EVENT_PAIR
STATUS_NO_GUID_TRANSLATION
STATUS_NO_IMPERSONATION_TOKEN
STATUS_NO_INHERITANCE
STATUS_NO_LDT
STATUS_NO_LOGON_SERVERS
STATUS_NO_LOG_SPACE
STATUS_NO_MATCH
STATUS_NO_MEDIA
STATUS_NO_MEDIA_IN_DEVICE
STATUS_NO_MEMORY
STATUS_NO_MORE_EAS
STATUS_NO_MORE_ENTRIES
STATUS_NO_MORE_FILES
STATUS_NO_MORE_MATCHES
STATUS_NO_PAGEFILE
STATUS_NO_QUOTAS_NO_ACCOUNT
STATUS_NO_SECURITY_ON_OBJECT
STATUS_NO_SPOOL_SPACE
STATUS_NO_SUCH_ALIAS
STATUS_NO_SUCH_DEVICE
STATUS_NO_SUCH_DOMAIN
STATUS_NO_SUCH_FILE
STATUS_NO_SUCH_GROUP
STATUS_NO_SUCH_LOGON_SESSION
STATUS_NO_SUCH_MEMBER
STATUS_NO_SUCH_PACKAGE
STATUS_NO_SUCH_PRIVILEGE
STATUS_NO_SUCH_USER
STATUS_NO_TOKEN
STATUS_NO_TRUST_LSA_SECRET
STATUS_NO_TRUST_SAM_ACCOUNT
STATUS_NO_USER_SESSION_KEY
STATUS_NO_YIELD_PERFORMED
STATUS_NT_CROSS_ENCRYPTION_REQUIRED
STATUS_NULL_LM_PASSWORD
STATUS_OBJECTID_EXISTS
STATUS_OBJECT_EXISTS
STATUS_OBJECT_NAME_COLLISION
STATUS_OBJECT_NAME_EXISTS
STATUS_OBJECT_NAME_INVALID
STATUS_OBJECT_NAME_NOT_FOUND
STATUS_OBJECT_PATH_INVALID
STATUS_OBJECT_PATH_NOT_FOUND
STATUS_OBJECT_PATH_SYNTAX_BAD
STATUS_OBJECT_TYPE_MISMATCH
STATUS_OPEN_FAILED
STATUS_OPLOCK_BREAK_IN_PROCESS
STATUS_OPLOCK_NOT_GRANTED
STATUS_ORDINAL_NOT_FOUND
STATUS_PAGEFILE_CREATE_FAILED
STATUS_PAGEFILE_QUOTA
STATUS_PAGEFILE_QUOTA_EXCEEDED
STATUS_PARITY_ERROR
STATUS_PARTIAL_COPY
STATUS_PARTITION_FAILURE
STATUS_PASSWORD_EXPIRED
STATUS_PASSWORD_MUST_CHANGE
STATUS_PASSWORD_RESTRICTION
STATUS_PATH_NOT_COVERED
STATUS_PENDING
STATUS_PIPE_BROKEN
STATUS_PIPE_BUSY
STATUS_PIPE_CLOSING
STATUS_PIPE_CONNECTED
STATUS_PIPE_DISCONNECTED
STATUS_PIPE_EMPTY
STATUS_PIPE_LISTENING
STATUS_PIPE_NOT_AVAILABLE
STATUS_PLUGPLAY_NO_DEVICE
STATUS_PORT_ALREADY_SET
STATUS_PORT_CONNECTION_REFUSED
STATUS_PORT_DISCONNECTED
STATUS_PORT_MESSAGE_TOO_LONG
STATUS_PORT_UNREACHABLE
STATUS_POSSIBLE_DEADLOCK
STATUS_PREDEFINED_HANDLE
STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED
STATUS_PRINT_CANCELLED
STATUS_PRINT_QUEUE_FULL
STATUS_PRIVILEGED_INSTRUCTION
STATUS_PRIVILEGE_NOT_HELD
STATUS_PROCEDURE_NOT_FOUND
STATUS_PROCESS_IN_JOB
STATUS_PROCESS_IS_TERMINATING
STATUS_PROCESS_NOT_IN_JOB
STATUS_PROFILING_AT_LIMIT
STATUS_PROFILING_NOT_STARTED
STATUS_PROFILING_NOT_STOPPED
STATUS_PROPSET_NOT_FOUND
STATUS_PROTOCOL_UNREACHABLE
STATUS_PWD_HISTORY_CONFLICT
STATUS_PWD_TOO_RECENT
STATUS_PWD_TOO_SHORT
STATUS_QUOTA_EXCEEDED
STATUS_QUOTA_LIST_INCONSISTENT
STATUS_RANGE_LIST_CONFLICT
STATUS_RANGE_NOT_FOUND
STATUS_RANGE_NOT_LOCKED
STATUS_RECEIVE_EXPEDITED
STATUS_RECEIVE_PARTIAL
STATUS_RECEIVE_PARTIAL_EXPEDITED
STATUS_RECOVERY_FAILURE
STATUS_REDIRECTOR_HAS_OPEN_HANDLES
STATUS_REDIRECTOR_NOT_STARTED
STATUS_REDIRECTOR_PAUSED
STATUS_REDIRECTOR_STARTED
STATUS_REGISTRY_CORRUPT
STATUS_REGISTRY_IO_FAILED
STATUS_REGISTRY_QUOTA_LIMIT
STATUS_REGISTRY_RECOVERED
STATUS_REMOTE_DISCONNECT
STATUS_REMOTE_NOT_LISTENING
STATUS_REMOTE_RESOURCES
STATUS_REMOTE_SESSION_LIMIT
STATUS_REPARSE
STATUS_REPLY_MESSAGE_MISMATCH
STATUS_REQUEST_ABORTED
STATUS_REQUEST_NOT_ACCEPTED
STATUS_RESOURCE_DATA_NOT_FOUND
STATUS_RESOURCE_LANG_NOT_FOUND
STATUS_RESOURCE_NAME_NOT_FOUND
STATUS_RESOURCE_NOT_OWNED
STATUS_RESOURCE_TYPE_NOT_FOUND
STATUS_RETRY
STATUS_REVISION_MISMATCH
STATUS_RXACT_COMMITTED
STATUS_RXACT_COMMIT_FAILURE
STATUS_RXACT_COMMIT_NECESSARY
STATUS_RXACT_INVALID_STATE
STATUS_RXACT_STATE_CREATED
STATUS_SAM_INIT_FAILURE
STATUS_SECRET_TOO_LONG
STATUS_SECTION_NOT_EXTENDED
STATUS_SECTION_NOT_IMAGE
STATUS_SECTION_PROTECTION
STATUS_SECTION_TOO_BIG
STATUS_SEGMENT_NOTIFICATION
STATUS_SEMAPHORE_LIMIT_EXCEEDED
STATUS_SERIAL_COUNTER_TIMEOUT
STATUS_SERIAL_MORE_WRITES
STATUS_SERIAL_NO_DEVICE_INITED
STATUS_SERVER_DISABLED
STATUS_SERVER_HAS_OPEN_HANDLES
STATUS_SERVER_NOT_DISABLED
STATUS_SERVICE_NOTIFICATION
STATUS_SETMARK_DETECTED
STATUS_SHARED_IRQ_BUSY
STATUS_SHARING_PAUSED
STATUS_SHARING_VIOLATION
STATUS_SINGLE_STEP
STATUS_SOME_NOT_MAPPED
STATUS_SPECIAL_ACCOUNT
STATUS_SPECIAL_GROUP
STATUS_SPECIAL_USER
STATUS_STACK_OVERFLOW
STATUS_STACK_OVERFLOW_READ
STATUS_SUCCESS
STATUS_SUSPEND_COUNT_EXCEEDED
STATUS_SYNCHRONIZATION_REQUIRED
STATUS_SYSTEM_PROCESS_TERMINATED
STATUS_THREAD_IS_TERMINATING
STATUS_THREAD_NOT_IN_PROCESS
STATUS_THREAD_WAS_SUSPENDED
STATUS_TIMEOUT
STATUS_TIMER_NOT_CANCELED
STATUS_TIMER_RESOLUTION_NOT_SET
STATUS_TIMER_RESUME_IGNORED
STATUS_TIME_DIFFERENCE_AT_DC
STATUS_TOKEN_ALREADY_IN_USE
STATUS_TOO_LATE
STATUS_TOO_MANY_ADDRESSES
STATUS_TOO_MANY_COMMANDS
STATUS_TOO_MANY_CONTEXT_IDS
STATUS_TOO_MANY_GUIDS_REQUESTED
STATUS_TOO_MANY_LINKS
STATUS_TOO_MANY_LUIDS_REQUESTED
STATUS_TOO_MANY_NAMES
STATUS_TOO_MANY_NODES
STATUS_TOO_MANY_OPENED_FILES
STATUS_TOO_MANY_PAGING_FILES
STATUS_TOO_MANY_SECRETS
STATUS_TOO_MANY_SESSIONS
STATUS_TOO_MANY_SIDS
STATUS_TOO_MANY_THREADS
STATUS_TRANSACTION_ABORTED
STATUS_TRANSACTION_INVALID_ID
STATUS_TRANSACTION_INVALID_TYPE
STATUS_TRANSACTION_NO_MATCH
STATUS_TRANSACTION_NO_RELEASE
STATUS_TRANSACTION_RESPONDED
STATUS_TRANSACTION_TIMED_OUT
STATUS_TRUSTED_DOMAIN_FAILURE
STATUS_TRUSTED_RELATIONSHIP_FAILURE
STATUS_TRUST_FAILURE
STATUS_UNABLE_TO_DECOMMIT_VM
STATUS_UNABLE_TO_DELETE_SECTION
STATUS_UNABLE_TO_FREE_VM
STATUS_UNABLE_TO_LOCK_MEDIA
STATUS_UNABLE_TO_UNLOAD_MEDIA
STATUS_UNDEFINED_CHARACTER
STATUS_UNEXPECTED_IO_ERROR
STATUS_UNEXPECTED_MM_CREATE_ERR
STATUS_UNEXPECTED_MM_EXTEND_ERR
STATUS_UNEXPECTED_MM_MAP_ERROR
STATUS_UNEXPECTED_NETWORK_ERROR
STATUS_UNHANDLED_EXCEPTION
STATUS_UNKNOWN_REVISION
STATUS_UNMAPPABLE_CHARACTER
STATUS_UNRECOGNIZED_MEDIA
STATUS_UNRECOGNIZED_VOLUME
STATUS_UNSUCCESSFUL
STATUS_UNSUPPORTED_COMPRESSION
STATUS_UNWIND
STATUS_USER_APC
STATUS_USER_EXISTS
STATUS_USER_MAPPED_FILE
STATUS_USER_SESSION_DELETED
STATUS_VALIDATE_CONTINUE
STATUS_VARIABLE_NOT_FOUND
STATUS_VDM_HARD_ERROR
STATUS_VERIFY_REQUIRED
STATUS_VIRTUAL_CIRCUIT_CLOSED
STATUS_VOLUME_DISMOUNTED
STATUS_VOLUME_MOUNTED
STATUS_WAIT_0
STATUS_WAIT_63
STATUS_WAKE_SYSTEM_DEBUGGER
STATUS_WAS_LOCKED
STATUS_WAS_UNLOCKED
STATUS_WORKING_SET_LIMIT_RANGE
STATUS_WORKING_SET_QUOTA
STATUS_WRONG_PASSWORD
STATUS_WRONG_PASSWORD_CORE
STATUS_WRONG_VOLUME
STATUS_WX86_BREAKPOINT
STATUS_WX86_CONTINUE
STATUS_WX86_CREATEWX86TIB
STATUS_WX86_EXCEPTION_CHAIN
STATUS_WX86_EXCEPTION_CONTINUE
STATUS_WX86_EXCEPTION_LASTCHANCE
STATUS_WX86_FLOAT_STACK_CHECK
STATUS_WX86_INTERNAL_ERROR
STATUS_WX86_SINGLE_STEP
STATUS_WX86_UNSIMULATE

View File

@@ -1,7 +0,0 @@
FAST_MUTEX
KPCR
PEB
TEB
SPINLOCK
APC
DPC

View File

@@ -1,73 +0,0 @@
What do you think I am, your personal tech support?
You *know* a %stru% is non-re-entrant, right?
The answer to that is so simple, I'm not going to waste my time telling you.
Well, of course... if you're not below DISPATCH_LEVEL, ros is gonna explode on ya when you try to do that ( duh! ).
I don't think that functionality has been implemented, yet.
What do you mean it crashed? It can't crash there!
Wow. That's a new one.
Ask %dev%, I bet he knows.. he knows everything...
When's the last time you rebuilt?
Have you tried a make clean?
Is it plugged in?
Well it works on *my* system :P
Well don't do that, and you won't have that problem.
Didn't we already fix that?
Well... I don't know.. I just have that code disabled in my tree.
Try surrounding it with parenthesis.
Don't you know going around dereferncing null pointers all day can be hazardous to your health?
Well, duh!
There's a bit in cr3 for problems like that.
Just add a field to the %stru% to keep track of it!
Don't worry about it... the garbage collector in %module% will clean it up for you.
Did I do that?
Didn't %dev% fix that already?
Yes, I think I've seen that bug before... no... that was another program.
I could tell you, but then I'd have to unlink() you.
Well if you'd get some sleep, maybe you'd figure it out... not all of us can keep the hours %dev% can...
You did what? Uh oh... that can't be good.
Well... I could tell you, but the answer's pretty complicated. Why don't you wait to read about it in the book I'm writing.
Yeah, that's happened to me, before, too. All you have to do is wrap it in an SEH block and forget about it.
Just put a NULL dereference in there and commit it. It helps get bugs fixed fast! (Not that I would know)
ASSERT is your friend!
I dunno.. but I bet %dev% could find it for you.
I hereby declare that code is perfect. Your problem must be elsewhere.
I wrote that code... it must be perfect.
$#@!$ One of these days I'm gonna throw %module% out the window!!! Sorry, what were you saying?
maybe I broke it in my last commit. Maybe I did it on purpose...
Have you tried debugging it? I got a can of Raid...
Just delete it, it can't be that important ( You should see all the useless cruft I got rid of in %module% )
Try queueing a work item...
My %stru% fell in love with some %stru% in %module%, and %module% has been hell since...
Maybe the PEB is getting corrupted. Try allocating a new PEB and overwriting the old one. That's what I did last time I had a bug like that.
Hmm.. that seems to have been introduced by my last commit... I bet CVS mixed up the bits during the commit.
It can't possibly be my fault, so I don't care.
I'm not experiencing that problem, perhaps it's all in your mind.
Well... like a good friend of mine said... "Don't Panic!"
It just shows you how far ReactOS has come along! A %period% ago a bug like that wouldn't have even been possible!
Just surround the code with an #if 0/#endif block, it solves all my problems!
You know.. if %dev% would just finish %module% for us, we wouldn't be having this problem.
I say we move on to the next function, since we can't seem to figure this one out.
Well, sure, that would have been my first guess, too.... TEN YEARS AGO :p
yup, that sounds like a problem.
If I wanted to talk about VB, I'd go bug Alex...
ask %dev%
Thank you for that amazingly keen insight, Commander Obvious.
Sorry, can't help you right now, trying to track down this bug %dev% caused in %module%
I dont know about that, but I just fixed a problem in %module% for %dev%
How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in %module%?
lol!
*wink*
;)
42
It's gonna take me over %period% to fix all %dev%'s bugs in %module% :(
How could %func% return %status%!? It bet %dev% broke it! I didn't touch it... honest! no.. really! (me hides)
It's fine if you get %status% there ... just ignore the destruction, and call %func% instead.
%dev% said %status% isn't really an error in this context because we expect %module% to be toast by now
heh, I'm still trying to figure out why %func% is returning %status% when I call it from %module%...
%dev% said it's okay to ignore that as long as you're below %irql%
erm, what do you mean?
damn, I do that all the time
if you want a reply that sounds right, I'd say that %func% support for that is vital to the future of %module%
Sounds like you're having a problem with %func%. I hate that thing... don't talk to me about it.
Just return %status% and forget about it. Someone else will fix it, later.
Blah blah blah... sheesh... can't you figure out *anything*?

View File

@@ -1,17 +0,0 @@
// trim.cpp
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#include "trim.h"
std::string trim ( const std::string& s )
{
const char* p = &s[0];
const char* p2 = p + s.size();
while ( *p == ' ' )
p++;
while ( p2 > p && p2[-1] == ' ' )
p2--;
return std::string ( p, p2-p );
}

View File

@@ -1,13 +0,0 @@
// trim.h
// This file is (C) 2004 Royce Mitchell III
// and released under the BSD & LGPL licenses
#ifndef TRIM_H
#define TRIM_H
#include <string>
std::string trim ( const std::string& s );
#endif//TRIM_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +0,0 @@
// verify.h
// This code is (C) 2003-2004 Royce Mitchell III
// and released under the LGPL & BSD licenses
#ifndef VERIFY_H
#define VERIFY_H
//#include <assert.h>
#ifdef ASSERT
#undef ASSERT
#endif//ASSERT
#include "panic.h"
#if defined(DEBUG) || defined(_DEBUG)
inline void AssertHandler ( bool b, const char* str )
{
if ( !b )
panic ( str );
}
# define ASSERT(x) AssertHandler((x) ? true : false, #x )
#else
# define ASSERT(x)
#endif
#ifdef verify
#undef verify
#endif//verify
#if defined(DEBUG) || defined(_DEBUG)
# define verify(x) ASSERT(x)
#else
# define verify(x) x
#endif
#endif//VERIFY_H

View File

@@ -1,32 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

View File

@@ -1,274 +0,0 @@
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Globalization;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>BinaryReaderHelp</c> implements static helper methods for extracting binary data
/// from a binary reader object.
/// </summary>
internal class BinaryReaderHelp
{
/// <summary>
/// Internal helper method to extract null-terminated strings from a binary reader
/// </summary>
/// <param name="binReader">reference to the binary reader</param>
/// <param name="offset">offset in the stream</param>
/// <param name="noOffset">true if the offset value should be used</param>
/// <param name="encoder">encoder used for text encoding</param>
/// <returns>An extracted string value</returns>
internal static string ExtractString(ref BinaryReader binReader, int offset, bool noOffset, Encoding encoder)
{
string strReturn = "";
if(encoder == null)
encoder = Encoding.ASCII;
ArrayList nameBytes = new ArrayList();
byte curByte;
if(!noOffset)
binReader.BaseStream.Seek(offset, SeekOrigin.Begin);
if(binReader.BaseStream.Position >= binReader.BaseStream.Length)
return "";
curByte = binReader.ReadByte();
while( (curByte != (byte)0) && (binReader.BaseStream.Position < binReader.BaseStream.Length) )
{
nameBytes.Add( curByte );
curByte = binReader.ReadByte();
}
byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte")));
strReturn = encoder.GetString(name,0,name.Length);
return strReturn;
}
/// <summary>
/// Internal helper method to extract a string with a specific length from the binary reader
/// </summary>
/// <param name="binReader">reference to the binary reader</param>
/// <param name="length">length of the string (number of bytes)</param>
/// <param name="offset">offset in the stream</param>
/// <param name="noOffset">true if the offset value should be used</param>
/// <param name="encoder">encoder used for text encoding</param>
/// <returns>An extracted string value</returns>
internal static string ExtractString(ref BinaryReader binReader, int length, int offset, bool noOffset, Encoding encoder)
{
string strReturn = "";
if(length == 0)
return "";
if(encoder == null)
encoder = Encoding.ASCII;
ArrayList nameBytes = new ArrayList();
byte curByte;
if(!noOffset)
binReader.BaseStream.Seek(offset, SeekOrigin.Begin);
if(binReader.BaseStream.Position >= binReader.BaseStream.Length)
return "";
curByte = binReader.ReadByte();
while( (curByte != (byte)0) && (nameBytes.Count < length) && (binReader.BaseStream.Position < binReader.BaseStream.Length) )
{
nameBytes.Add( curByte );
if(nameBytes.Count < length)
curByte = binReader.ReadByte();
}
byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte")));
strReturn = encoder.GetString(name,0,name.Length);
return strReturn;
}
/// <summary>
/// Internal helper method to extract a string with a specific length from the binary reader
/// </summary>
/// <param name="binReader">reference to the binary reader</param>
/// <param name="bFoundTerminator">reference to a bool vairable which will receive true if the
/// string terminator \0 was found. false indicates that the end of the stream was reached.</param>
/// <param name="offset">offset in the stream</param>
/// <param name="noOffset">true if the offset value should be used</param>
/// <param name="encoder">encoder used for text encoding</param>
/// <returns>An extracted string value</returns>
internal static string ExtractString(ref BinaryReader binReader, ref bool bFoundTerminator, int offset, bool noOffset, Encoding encoder)
{
string strReturn = "";
ArrayList nameBytes = new ArrayList();
byte curByte;
if(encoder == null)
encoder = Encoding.ASCII;
if(!noOffset)
binReader.BaseStream.Seek(offset, SeekOrigin.Begin);
if(binReader.BaseStream.Position >= binReader.BaseStream.Length)
return "";
curByte = binReader.ReadByte();
while( (curByte != (byte)0) && (binReader.BaseStream.Position < binReader.BaseStream.Length) )
{
nameBytes.Add( curByte );
curByte = binReader.ReadByte();
if( curByte == (byte)0 )
{
bFoundTerminator = true;
}
}
byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte")));
strReturn = encoder.GetString(name,0,name.Length);
return strReturn;
}
/// <summary>
/// Internal helper method to extract a null-terminated UTF-16/UCS-2 strings from a binary reader
/// </summary>
/// <param name="binReader">reference to the binary reader</param>
/// <param name="offset">offset in the stream</param>
/// <param name="noOffset">true if the offset value should be used</param>
/// <param name="encoder">encoder used for text encoding</param>
/// <returns>An extracted string value</returns>
internal static string ExtractUTF16String(ref BinaryReader binReader, int offset, bool noOffset, Encoding encoder)
{
string strReturn = "";
ArrayList nameBytes = new ArrayList();
byte curByte;
int lastByte=-1;
if(!noOffset)
binReader.BaseStream.Seek(offset, SeekOrigin.Begin);
if(binReader.BaseStream.Position >= binReader.BaseStream.Length)
return "";
if(encoder == null)
encoder = Encoding.Unicode;
curByte = binReader.ReadByte();
int nCnt = 0;
while( ((curByte != (byte)0) || (lastByte != 0) ) && (binReader.BaseStream.Position < binReader.BaseStream.Length) )
{
nameBytes.Add( curByte );
if(nCnt%2 == 0)
lastByte = (int)curByte;
curByte = binReader.ReadByte();
nCnt++;
}
byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte")));
strReturn = Encoding.Unicode.GetString(name,0,name.Length);
// apply text encoding
name = Encoding.Default.GetBytes(strReturn);
strReturn = encoder.GetString(name,0,name.Length);
return strReturn;
}
/// <summary>
/// Internal helper for reading ENCINT encoded integer values
/// </summary>
/// <param name="binReader">reference to the reader</param>
/// <returns>a long value</returns>
internal static long ReadENCINT(ref BinaryReader binReader)
{
long nRet = 0;
byte buffer = 0;
int shift = 0;
if(binReader.BaseStream.Position >= binReader.BaseStream.Length)
return nRet;
do
{
buffer = binReader.ReadByte();
nRet |= ((long)((buffer & (byte)0x7F))) << shift;
shift += 7;
}while ( (buffer & (byte)0x80) != 0);
return nRet;
}
/// <summary>
/// Reads an s/r encoded value from the byte array and decodes it into an integer
/// </summary>
/// <param name="wclBits">a byte array containing all bits (contains only 0 or 1 elements)</param>
/// <param name="s">scale param for encoding</param>
/// <param name="r">root param for encoding</param>
/// <param name="nBitIndex">current index in the wclBits array</param>
/// <returns>Returns an decoded integer value.</returns>
internal static int ReadSRItem(byte[] wclBits, int s, int r, ref int nBitIndex)
{
int nRet = 0;
int q = r;
int nPref1Cnt = 0;
while( wclBits[nBitIndex++] == 1)
{
nPref1Cnt++;
}
if(nPref1Cnt == 0)
{
int nMask = 0;
for(int nbits=0; nbits<q;nbits++)
{
nMask |= ( 0x01 & (int)wclBits[nBitIndex]) << (q-nbits-1);
nBitIndex++;
}
nRet = nMask;
}
else
{
q += (nPref1Cnt-1);
int nMask = 0;
int nRMaxValue = 0;
for(int nbits=0; nbits<q;nbits++)
{
nMask |= ( 0x01 & (int)wclBits[nBitIndex]) << (q-nbits-1);
nBitIndex++;
}
for(int nsv=0; nsv<r; nsv++)
{
nRMaxValue = nRMaxValue << 1;
nRMaxValue |= 0x1;
}
nRMaxValue++; // startvalue of s/r encoding with 1 prefixing '1'
nRMaxValue *= (int) Math.Pow((double)2, (double)(nPref1Cnt-1));
nRet = nRMaxValue + nMask;
}
return nRet;
}
}
}

View File

@@ -1,325 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMBtree</c> implements methods/properties to decode the binary help index.
/// This class automatically creates an index arraylist for the current CHMFile instance.
/// It does not store the index internally !
/// </summary>
/// <remarks>The binary index can be found in the storage file $WWKeywordLinks/BTree</remarks>
internal sealed class CHMBtree : IDisposable
{
/// <summary>
/// Constant specifying the size of the string blocks
/// </summary>
private const int BLOCK_SIZE = 2048;
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing flags
/// </summary>
private int _flags = 0;
/// <summary>
/// Internal member storing the data format
/// </summary>
private byte[] _dataFormat = new byte[16];
/// <summary>
/// Internal member storing the index of the last listing block
/// </summary>
private int _indexOfLastListingBlock = 0;
/// <summary>
/// Internal member storing the index of the root block
/// </summary>
private int _indexOfRootBlock = 0;
/// <summary>
/// Internal member storing the number of blocks
/// </summary>
private int _numberOfBlocks = 0;
/// <summary>
/// Internal member storing the tree depth.
/// (1 if no index blocks, 2 one level of index blocks, ...)
/// </summary>
private int _treeDepth = 0;
/// <summary>
/// Internal member storing the number of keywords in the file
/// </summary>
private int _numberOfKeywords = 0;
/// <summary>
/// Internal member storing the codepage
/// </summary>
private int _codePage = 0;
/// <summary>
/// true if the index is from a CHI or CHM file, else CHW
/// </summary>
private bool _isCHI_CHM = true;
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Internal flag specifying if we have to read listing or index blocks
/// </summary>
private bool _readListingBlocks = true;
/// <summary>
/// Internal member storing an indexlist of the current file.
/// </summary>
private ArrayList _indexList = new ArrayList();
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the $WWKeywordLinks/BTree file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMBtree(byte[] binaryFileData, CHMFile associatedFile)
{
if( associatedFile == null)
{
throw new ArgumentException("CHMBtree.ctor() - Associated CHMFile must not be null !", "associatedFile");
}
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
// clear internal binary data after extraction
_binaryFileData = null;
}
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nCurOffset = 0;
int nTemp = 0;
// decode header
binReader.ReadChars(2); // 2chars signature (not important)
_flags = (int)binReader.ReadInt16(); // WORD flags
binReader.ReadInt16(); // size of blocks (always 2048)
_dataFormat = binReader.ReadBytes(16);
binReader.ReadInt32(); // unknown DWORD
_indexOfLastListingBlock = binReader.ReadInt32();
_indexOfRootBlock = binReader.ReadInt32();
binReader.ReadInt32(); // unknown DWORD
_numberOfBlocks = binReader.ReadInt32();
_treeDepth = binReader.ReadInt16();
_numberOfKeywords = binReader.ReadInt32();
_codePage = binReader.ReadInt32();
binReader.ReadInt32(); // lcid DWORD
nTemp = binReader.ReadInt32();
_isCHI_CHM = (nTemp==1);
binReader.ReadInt32(); // unknown DWORD
binReader.ReadInt32(); // unknown DWORD
binReader.ReadInt32(); // unknown DWORD
binReader.ReadInt32(); // unknown DWORD
// end of header decode
while( (memStream.Position < memStream.Length) && (bRet) )
{
nCurOffset = (int)memStream.Position;
byte [] dataBlock = binReader.ReadBytes(BLOCK_SIZE);
bRet &= DecodeBlock(dataBlock, ref nCurOffset, _treeDepth-1);
}
return bRet;
}
/// <summary>
/// Decodes a block of url-string data
/// </summary>
/// <param name="dataBlock">block of data</param>
/// <param name="nOffset">current file offset</param>
/// <param name="indexBlocks">number of index blocks</param>
/// <returns>true if succeeded</returns>
private bool DecodeBlock( byte[] dataBlock, ref int nOffset, int indexBlocks )
{
bool bRet = true;
int nblockOffset = nOffset;
MemoryStream memStream = new MemoryStream(dataBlock);
BinaryReader binReader = new BinaryReader(memStream);
int freeSpace = binReader.ReadInt16(); // length of freespace
int nrOfEntries = binReader.ReadInt16(); // number of entries
bool bListingEndReached = false;
//while( (memStream.Position < (memStream.Length-freeSpace)) && (bRet) )
//{
int nIndexOfPrevBlock = -1;
int nIndexOfNextBlock = -1;
int nIndexOfChildBlock = 0;
if(_readListingBlocks)
{
nIndexOfPrevBlock = binReader.ReadInt32(); // -1 if this is the header
nIndexOfNextBlock = binReader.ReadInt32(); // -1 if this is the last block
}
else
{
nIndexOfChildBlock = binReader.ReadInt32();
}
for(int nE = 0; nE < nrOfEntries; nE++)
{
if(_readListingBlocks)
{
bListingEndReached = (nIndexOfNextBlock==-1);
string keyWord = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding);
bool isSeeAlsoKeyword = (binReader.ReadInt16()!=0);
int indent = binReader.ReadInt16(); // indent of entry
int nCharIndex = binReader.ReadInt32();
binReader.ReadInt32();
int numberOfPairs = binReader.ReadInt32();
int[] nTopics = new int[numberOfPairs];
string[] seeAlso = new string[numberOfPairs];
for(int i=0; i < numberOfPairs; i++)
{
if(isSeeAlsoKeyword)
{
seeAlso[i] = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding);
}
else
{
nTopics[i] = binReader.ReadInt32();
}
}
binReader.ReadInt32(); // unknown
int nIndexOfThisEntry = binReader.ReadInt32();
IndexItem newItem = new IndexItem(_associatedFile, keyWord, isSeeAlsoKeyword, indent, nCharIndex, nIndexOfThisEntry, seeAlso, nTopics);
_indexList.Add(newItem);
}
else
{
string keyWord = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding);
bool isSeeAlsoKeyword = (binReader.ReadInt16()!=0);
int indent = binReader.ReadInt16(); // indent of entry
int nCharIndex = binReader.ReadInt32();
binReader.ReadInt32();
int numberOfPairs = binReader.ReadInt32();
int[] nTopics = new int[numberOfPairs];
string[] seeAlso = new string[numberOfPairs];
for(int i=0; i < numberOfPairs; i++)
{
if(isSeeAlsoKeyword)
{
seeAlso[i] = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding);
}
else
{
nTopics[i] = binReader.ReadInt32();
}
}
int nIndexChild = binReader.ReadInt32();
int nIndexOfThisEntry=-1;
IndexItem newItem = new IndexItem(_associatedFile, keyWord, isSeeAlsoKeyword, indent, nCharIndex, nIndexOfThisEntry, seeAlso, nTopics);
_indexList.Add(newItem);
}
}
//}
binReader.ReadBytes(freeSpace);
if( bListingEndReached )
_readListingBlocks = false;
return bRet;
}
/// <summary>
/// Gets the internal generated index list
/// </summary>
internal ArrayList IndexList
{
get { return _indexList; }
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
}
}
disposed = true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,286 +0,0 @@
using System;
using System.Collections;
using System.IO;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMIdxhdr</c> implements t properties which have been read from the #IDXHDR file.
/// </summary>
internal sealed class CHMIdxhdr : IDisposable
{
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the number of topic nodes including the contents and index files
/// </summary>
private int _numberOfTopicNodes = 0;
/// <summary>
/// Internal member storing the offset in the #STRINGS file of the ImageList param of the "text/site properties" object of the sitemap contents
/// </summary>
private int _imageListOffset = 0;
/// <summary>
/// True if the value of the ImageType param of the "text/site properties" object of the sitemap contents is "Folder".
/// </summary>
private bool _imageTypeFolder = false;
/// <summary>
/// Internal member storing the background value
/// </summary>
private int _background = 0;
/// <summary>
/// Internal member storing the foreground value
/// </summary>
private int _foreground = 0;
/// <summary>
/// Internal member storing the offset in the #STRINGS file of the Font param of the "text/site properties" object of the sitemap contents
/// </summary>
private int _fontOffset = 0;
/// <summary>
/// Internal member storing the offset in the #STRINGS file of the FrameName param of the "text/site properties" object of the sitemap contents
/// </summary>
private int _frameNameOffset = 0;
/// <summary>
/// Internal member storing the offset in the #STRINGS file of the WindowName param of the "text/site properties" object of the sitemap contents
/// </summary>
private int _windowNameOffset = 0;
/// <summary>
/// Internal member storing the number of merged files
/// </summary>
private int _numberOfMergedFiles = 0;
/// <summary>
/// Internal member storing the offset in the #STRINGS file of the merged file names
/// </summary>
private ArrayList _mergedFileOffsets = new ArrayList();
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #IDXHDR file</param>
/// <param name="associatedFile">associated CHMFile instance</param>
public CHMIdxhdr(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
}
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nTemp = 0;
// 4 character T#SM
binReader.ReadBytes(4);
// unknown timestamp DWORD
nTemp = binReader.ReadInt32();
// unknown 1
nTemp = binReader.ReadInt32();
// number of topic nodes including the contents & index files
_numberOfTopicNodes = binReader.ReadInt32();
// unknown DWORD
nTemp = binReader.ReadInt32();
// offset in the strings file
_imageListOffset = binReader.ReadInt32();
if( _imageListOffset == 0)
_imageListOffset = -1; // 0/-1 = none
// unknown DWORD
nTemp = binReader.ReadInt32();
// 1 if the value of the ImageType param of the "text/site properties" object of the sitemap contents is "Folder".
nTemp = binReader.ReadInt32();
_imageTypeFolder = (nTemp == 1);
// offset in the strings file
_background = binReader.ReadInt32();
// offset in the strings file
_foreground = binReader.ReadInt32();
// offset in the strings file
_fontOffset = binReader.ReadInt32();
// window styles DWORD
nTemp = binReader.ReadInt32();
// window styles DWORD
nTemp = binReader.ReadInt32();
// unknown DWORD
nTemp = binReader.ReadInt32();
// offset in the strings file
_frameNameOffset = binReader.ReadInt32();
if( _frameNameOffset == 0)
_frameNameOffset = -1; // 0/-1 = none
// offset in the strings file
_windowNameOffset = binReader.ReadInt32();
if( _windowNameOffset == 0)
_windowNameOffset = -1; // 0/-1 = none
// informations types DWORD
nTemp = binReader.ReadInt32();
// unknown DWORD
nTemp = binReader.ReadInt32();
// number of merged files in the merged file list DWORD
_numberOfMergedFiles = binReader.ReadInt32();
nTemp = binReader.ReadInt32();
for(int i = 0; i < _numberOfMergedFiles; i++)
{
// DWORD offset value of merged file
nTemp = binReader.ReadInt32();
if(nTemp > 0)
_mergedFileOffsets.Add(nTemp);
}
return bRet;
}
/// <summary>
/// Gets the number of topic nodes including the contents and index files
/// </summary>
public int NumberOfTopicNodes
{
get { return _numberOfTopicNodes; }
}
/// <summary>
/// Gets the offset in the #STRINGS file of the ImageList
/// param of the "text/site properties" object of the sitemap contents
/// </summary>
public int ImageListOffset
{
get { return _imageListOffset; }
}
/// <summary>
/// True if the value of the ImageType param of the
/// "text/site properties" object of the sitemap contents is "Folder".
/// </summary>
/// <remarks>If this is set to true, the help will display folders instead of books</remarks>
public bool ImageTypeFolder
{
get { return _imageTypeFolder; }
}
/// <summary>
/// Gets the background setting
/// </summary>
public int Background
{
get { return _background; }
}
/// <summary>
/// Gets the foreground setting
/// </summary>
public int Foreground
{
get { return _foreground; }
}
/// <summary>
/// Gets the offset in the #STRINGS file of the Font
/// param of the "text/site properties" object of the sitemap contents
/// </summary>
public int WindowNameOffset
{
get { return _fontOffset; }
}
/// <summary>
/// Gets the offset in the #STRINGS file of the FrameName
/// param of the "text/site properties" object of the sitemap contents
/// </summary>
public int FrameNameOffset
{
get { return _frameNameOffset; }
}
/// <summary>
/// Gets the offset in the #STRINGS file of the WindowName
/// param of the "text/site properties" object of the sitemap contents
/// </summary>
public int FontOffset
{
get { return _windowNameOffset; }
}
/// <summary>
/// Gets an array list of offset numbers in the #STRINGS file of the
/// merged file names.
/// </summary>
public ArrayList MergedFileOffsets
{
get { return _mergedFileOffsets; }
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_mergedFileOffsets = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,256 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMStrings</c> implements a string collection read from the #STRINGS file
/// </summary>
internal sealed class CHMStrings : IDisposable
{
/// <summary>
/// Constant specifying the size of the string blocks
/// </summary>
private const int STRING_BLOCK_SIZE = 4096;
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the string dictionary
/// </summary>
private Hashtable _stringDictionary = new Hashtable();
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #STRINGS file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMStrings(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
}
/// <summary>
/// Standard constructor
/// </summary>
internal CHMStrings()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _stringDictionary.Count );
if (_stringDictionary.Count != 0)
{
IDictionaryEnumerator iDictionaryEnumerator = _stringDictionary.GetEnumerator();
while (iDictionaryEnumerator.MoveNext())
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)iDictionaryEnumerator.Current;
writer.Write( Int32.Parse(dictionaryEntry.Key.ToString()) );
writer.Write( dictionaryEntry.Value.ToString() );
}
}
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
int nCnt = reader.ReadInt32();
for(int i=0; i<nCnt;i++)
{
int nKey = reader.ReadInt32();
string sValue = reader.ReadString();
_stringDictionary[nKey.ToString()] = sValue;
}
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
}
#endregion
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
//binReader.ReadByte(); // file starts with a NULL character for 0-based offset indexing
int nStringOffset = 0;
int nSubsetOffset = 0;
while( (memStream.Position < memStream.Length) && (bRet) )
{
nStringOffset = (int)memStream.Position;
byte [] stringBlock = binReader.ReadBytes(STRING_BLOCK_SIZE);
bRet &= DecodeBlock(stringBlock, ref nStringOffset, ref nSubsetOffset);
}
return bRet;
}
/// <summary>
/// Decodes a string block
/// </summary>
/// <param name="stringBlock">byte array which represents the string block</param>
/// <param name="nStringOffset">current string offset number</param>
/// <param name="nSubsetOffset">reference to a subset variable</param>
/// <returns>true if succeeded</returns>
/// <remarks>If a string crosses the end of a block then it will be cut off
/// without a NT and repeated in full, with a NT, at the start of the next block.
/// For eg "To customize the appearance of a contents file" might become
/// "To customize the (block ending)To customize the appearance of a contents file"
/// when there are 17 bytes left at the end of the block. </remarks>
private bool DecodeBlock( byte[] stringBlock, ref int nStringOffset, ref int nSubsetOffset)
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(stringBlock);
BinaryReader binReader = new BinaryReader(memStream);
while( (memStream.Position < memStream.Length) && (bRet) )
{
bool bFoundTerminator = false;
int nCurOffset = nStringOffset + (int)memStream.Position;
string sTemp = BinaryReaderHelp.ExtractString(ref binReader, ref bFoundTerminator, 0, true, _associatedFile.TextEncoding);
if(nSubsetOffset != 0)
{
_stringDictionary[nSubsetOffset.ToString()] = sTemp.ToString();
}
else
{
_stringDictionary[nCurOffset.ToString()] = sTemp.ToString();
}
if( bFoundTerminator )
{
nSubsetOffset = 0;
}
else
{
nSubsetOffset = nCurOffset;
}
}
return bRet;
}
/// <summary>
/// Indexer which returns the string at a given offset
/// </summary>
public string this[int offset]
{
get
{
if(offset == -1)
return String.Empty;
string sTemp = (string)_stringDictionary[ offset.ToString() ];
if(sTemp == null)
return String.Empty;
return sTemp;
}
}
/// <summary>
/// Indexer which returns the string at a given offset
/// </summary>
public string this[string offset]
{
get
{
if(offset == "-1")
return String.Empty;
string sTemp = (string)_stringDictionary[ offset ];
if(sTemp == null)
return String.Empty;
return sTemp;
}
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_stringDictionary = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,821 +0,0 @@
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Globalization;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMSystem</c> reads the #SYSTEM file of the chm and stores its settings
/// </summary>
internal sealed class CHMSystem : IDisposable
{
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the file version
/// </summary>
private int _fileVersion = 0;
/// <summary>
/// Internal member storing the contents file path
/// </summary>
private string _contentsFile = "";
/// <summary>
/// Internal member storing the index file path
/// </summary>
private string _indexFile = "";
/// <summary>
/// Internal member storing the default help topic
/// </summary>
private string _defaultTopic = "";
/// <summary>
/// Internal member storing the help-window title
/// </summary>
private string _title = "";
/// <summary>
/// Internal flag if dbcs is on
/// </summary>
private bool _dbcs = false;
/// <summary>
/// Internal flag if fulltext search is enabled
/// </summary>
private bool _fullTextSearch = false;
/// <summary>
/// Internal flag if KLinks are in the file
/// </summary>
private bool _hasKLinks = false;
/// <summary>
/// Internal flag if ALinks are in the file
/// </summary>
private bool _hasALinks = false;
/// <summary>
/// Internal member storing the name of the default window
/// </summary>
private string _defaultWindow = "";
/// <summary>
/// Internal member storing the filename of the compiled file
/// </summary>
private string _compileFile = "";
/// <summary>
/// Internal flag storing the offset value of the binary index
/// </summary>
private uint _binaryIndexURLTableID = 0;
/// <summary>
/// Inernal member storing the compiler version this file was compiled
/// </summary>
private string _compilerVersion = "";
/// <summary>
/// Internal flag storing the offset value of the binary TOC
/// </summary>
private uint _binaryTOCURLTableID = 0;
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Internal member storing the default fontface, size, charset
/// </summary>
private string _defaultFont = "";
/// <summary>
/// Internal member storing the culture info of the file
/// </summary>
private CultureInfo _culture;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #SYSTEM file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMSystem(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
if(_culture == null)
{
// Set the text encoder of the chm file to the read charset/codepage
_associatedFile.TextEncoding = Encoding.GetEncoding( this.CodePage );
}
}
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
// First entry = DWORD for version number
_fileVersion = (int) binReader.ReadInt32();
while( (memStream.Position < memStream.Length) && (bRet) )
{
bRet &= DecodeEntry(ref binReader);
}
return bRet;
}
/// <summary>
/// Decodes an #system file entry
/// </summary>
/// <param name="binReader">binary reader reference</param>
/// <returns>true if succeeded</returns>
private bool DecodeEntry(ref BinaryReader binReader)
{
bool bRet = true;
int code = (int) binReader.ReadInt16(); // entry code, WORD
int length = (int) binReader.ReadInt16(); // length of entry
switch(code)
{
case 0:
{
_contentsFile = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 1:
{
_indexFile = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 2:
{
_defaultTopic = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 3:
{
_title = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 4:
{
int nTemp = 0;
nTemp = binReader.ReadInt32(); // read DWORD LCID
_culture = new CultureInfo(nTemp);
if(_culture != null)
_associatedFile.TextEncoding = Encoding.GetEncoding(_culture.TextInfo.ANSICodePage);
nTemp = binReader.ReadInt32(); // read DWORD DBCS
_dbcs = (nTemp == 1);
nTemp = binReader.ReadInt32(); // read DWORD Fulltext search
_fullTextSearch = (nTemp == 1);
nTemp = binReader.ReadInt32(); // read DWORD has klinks
_hasKLinks = (nTemp != 0);
nTemp = binReader.ReadInt32(); // read DWORD has alinks
_hasALinks = (nTemp != 0);
// read the rest of code 4 (not important for us)
byte[] temp = new byte[length-(5*4)];
temp = binReader.ReadBytes(length-(5*4));
};break;
case 5:
{
_defaultWindow = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 6:
{
_compileFile = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 7:
{
if(_fileVersion > 2)
{
_binaryIndexURLTableID = (uint) binReader.ReadInt32();
}
else
{
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
}
};break;
case 8:
{
// abbreviation (not interresting for us)
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 9:
{
_compilerVersion = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
case 10:
{
// timestamp of the file (not interresting for us)
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 11:
{
if(_fileVersion > 2)
{
_binaryTOCURLTableID = (uint) binReader.ReadInt32();
}
else
{
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
}
};break;
case 12:
{
// number of information bytes
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 13:
{
// copy of file #idxhdr
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 14:
{
// custom tabs for HH viewer
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 15:
{
// a checksum
byte[] read = binReader.ReadBytes(length);
int i=read.Length;
};break;
case 16:
{
// Default Font=string,number,number
// The string is the name of the font, the first number is the
// point size & the last number is the character set used by the font.
// For acceptable values see *_CHARSET defines in wingdi.h from the
// Windows SDK or the same file in MinGW or Wine.
// Most of the time you will only want to use 0, which is the value for ANSI,
// which is the subset of ASCII used by Windows.
_defaultFont = BinaryReaderHelp.ExtractString(ref binReader,length, 0, true, _associatedFile.TextEncoding);
};break;
default:
{
byte[] temp = new byte[length];
temp = binReader.ReadBytes(length);
//bRet = false;
int i=temp.Length;
};break;
}
return bRet;
}
/// <summary>
/// Reads all HHC files and checks which one has the global object tag.
/// This hhc file will be returned as master hhc
/// </summary>
/// <param name="hhcTopics">list of topics containing the extension hhc</param>
/// <param name="TopicItemArrayList">true if the arraylist contains topic items</param>
/// <returns>the filename of the found master toc</returns>
private string GetMasterHHC(ArrayList hhcTopics, bool TopicItemArrayList)
{
string sRet = "";
if( (hhcTopics!=null) && (hhcTopics.Count > 0) )
{
if( TopicItemArrayList )
{
if(hhcTopics.Count == 1)
{
sRet = ((TopicEntry)hhcTopics[0]).Locale;
}
else
{
foreach(TopicEntry curEntry in hhcTopics)
{
CHMStream.CHMStream iw=null;
MemoryStream fileObject=null;
if( _associatedFile.CurrentStorageWrapper == null)
{
iw=new CHMStream.CHMStream();
iw.OpenCHM(_associatedFile.ChmFilePath);
}
else
{
iw = _associatedFile.CurrentStorageWrapper;
}
fileObject = iw.OpenStream(curEntry.Locale);
if( fileObject != null)
{
string fileString =_associatedFile.TextEncoding.GetString(fileObject.ToArray(),0,(int)fileObject.Length);
fileObject.Close();
if( HHCParser.HasGlobalObjectTag(fileString, _associatedFile) )
{
sRet = curEntry.Locale;
break;
}
}
}
}
}
else
{
if(hhcTopics.Count == 1)
{
sRet = ((string)hhcTopics[0]);
}
else
{
foreach(string curEntry in hhcTopics)
{
CHMStream.CHMStream iw=null;
MemoryStream fileObject=null;
if( _associatedFile.CurrentStorageWrapper == null)
{
iw=new CHMStream.CHMStream();
iw.OpenCHM(_associatedFile.ChmFilePath);
}
else
{
iw = _associatedFile.CurrentStorageWrapper;
}
fileObject = iw.OpenStream(curEntry);
if( fileObject != null)
{
string fileString =_associatedFile.TextEncoding.GetString(fileObject.ToArray(),0,(int)fileObject.Length);
fileObject.Close();
if( HHCParser.HasGlobalObjectTag(fileString, _associatedFile) )
{
sRet = curEntry;
break;
}
}
}
}
}
}
return sRet;
}
/// <summary>
/// Gets the file version of the chm file.
/// 2 for Compatibility=1.0, 3 for Compatibility=1.1
/// </summary>
public int FileVersion
{
get { return _fileVersion; }
}
/// <summary>
/// Gets the contents file name
/// </summary>
public string ContentsFile
{
get
{
if( BinaryTOC ) // if the file contains a binary TOC
{
// make sure the CHMFile instance exists and has loaded the file #URLTBL
if( (_associatedFile != null) && (_associatedFile.UrltblFile != null ) )
{
// Get an url-table entry by its unique id
UrlTableEntry entry = _associatedFile.UrltblFile.GetByUniqueID( this.BinaryTOCURLTableID );
if(entry != null)
{
// entry found, return the url ( = filename )
return entry.URL;
}
}
}
else
{
if(_contentsFile.Length <= 0)
{
string sCheck = "Table of Contents.hhc"; // default HHP contents filename
if( (_associatedFile != null) && (_associatedFile.TopicsFile != null ) )
{
TopicEntry te = _associatedFile.TopicsFile.GetByLocale( sCheck );
if( te == null)
{
sCheck = "toc.hhc"; // default HHP contents filename
te = _associatedFile.TopicsFile.GetByLocale( sCheck );
if( te == null)
{
sCheck = CompileFile + ".hhc";
te = _associatedFile.TopicsFile.GetByLocale( sCheck );
if( te == null)
{
ArrayList arrExt = _associatedFile.TopicsFile.GetByExtension("hhc");
if( arrExt == null )
{
arrExt = _associatedFile.EnumFilesByExtension("hhc");
if( arrExt == null )
{
Debug.WriteLine("CHMSystem.ContentsFile - Failed, contents file not found !");
}
else
{
if(arrExt.Count > 1)
{
sCheck = GetMasterHHC(arrExt, false);
_contentsFile = sCheck;
}
else
{
_contentsFile = ((string)arrExt[0]);
sCheck = _contentsFile;
}
}
}
else
{
if(arrExt.Count > 1)
{
sCheck = GetMasterHHC(arrExt, true);
_contentsFile = sCheck;
}
else
{
_contentsFile = ((TopicEntry)arrExt[0]).Locale;
sCheck = _contentsFile;
}
}
}
else
{
_contentsFile = sCheck;
}
}
else
{
_contentsFile = sCheck;
}
}
else
{
_contentsFile = sCheck;
}
}
return sCheck;
}
}
return _contentsFile;
}
}
/// <summary>
/// Gets the index file name
/// </summary>
public string IndexFile
{
get
{
if( BinaryIndex ) // if the file contains a binary index
{
// make sure the CHMFile instance exists and has loaded the file #URLTBL
if( (_associatedFile != null) && (_associatedFile.UrltblFile != null ) )
{
// Get an url-table entry by its unique id
UrlTableEntry entry = _associatedFile.UrltblFile.GetByUniqueID( this.BinaryIndexURLTableID );
if(entry != null)
{
// entry found, return the url ( = filename )
return entry.URL;
}
}
}
else
{
if(_indexFile.Length <= 0)
{
string sCheck = "Index.hhk"; // default HHP index filename
if( (_associatedFile != null) && (_associatedFile.TopicsFile != null ) )
{
TopicEntry te = _associatedFile.TopicsFile.GetByLocale( sCheck );
if( te == null)
{
sCheck = CompileFile + ".hhk";
te = _associatedFile.TopicsFile.GetByLocale( sCheck );
if( te == null)
{
ArrayList arrExt = _associatedFile.TopicsFile.GetByExtension("hhk");
if( arrExt == null )
{
Debug.WriteLine("CHMSystem.IndexFile - Failed, index file not found !");
}
else
{
_indexFile = ((TopicEntry)arrExt[0]).Locale;
sCheck = _indexFile;
}
}
else
{
_indexFile = sCheck;
}
}
else
{
_indexFile = sCheck;
}
}
return sCheck;
}
}
return _indexFile;
}
}
/// <summary>
/// Sets the default topic of this file
/// </summary>
/// <param name="local">new local value of the topic</param>
internal void SetDefaultTopic(string local)
{
_defaultTopic = local;
}
/// <summary>
/// Gets the default help topic
/// </summary>
public string DefaultTopic
{
get { return _defaultTopic; }
}
/// <summary>
/// Gets the title of the help window
/// </summary>
public string Title
{
get { return _title; }
}
/// <summary>
/// Gets the flag if DBCS is in use
/// </summary>
public bool DBCS
{
get { return _dbcs; }
}
/// <summary>
/// Gets the flag if full-text-search is available
/// </summary>
public bool FullTextSearch
{
get { return _fullTextSearch; }
}
/// <summary>
/// Gets the flag if the file has ALinks
/// </summary>
public bool HasALinks
{
get { return _hasALinks; }
}
/// <summary>
/// Gets the flag if the file has KLinks
/// </summary>
public bool HasKLinks
{
get { return _hasKLinks; }
}
/// <summary>
/// Gets the default window name
/// </summary>
public string DefaultWindow
{
get { return _defaultWindow; }
}
/// <summary>
/// Gets the file name of the compile file
/// </summary>
public string CompileFile
{
get { return _compileFile; }
}
/// <summary>
/// Gets the id of the binary index in the url table
/// </summary>
public uint BinaryIndexURLTableID
{
get { return _binaryIndexURLTableID; }
}
/// <summary>
/// Gets the flag if the chm has a binary index file
/// </summary>
public bool BinaryIndex
{
get { return (_binaryIndexURLTableID>0); }
}
/// <summary>
/// Gets the flag if the chm has a binary index file
/// </summary>
public string CompilerVersion
{
get { return _compilerVersion; }
}
/// <summary>
/// Gets the id of the binary toc in the url table
/// </summary>
public uint BinaryTOCURLTableID
{
get { return _binaryTOCURLTableID; }
}
/// <summary>
/// Gets the flag if the chm has a binary toc file
/// </summary>
public bool BinaryTOC
{
get { return (_binaryTOCURLTableID>0); }
}
/// <summary>
/// Gets the font face of the read font property.
/// Empty string for default font.
/// </summary>
public string FontFace
{
get
{
if( _defaultFont.Length > 0)
{
string [] fontSplit = _defaultFont.Split( new char[]{','});
if(fontSplit.Length > 0)
return fontSplit[0].Trim();
}
return "";
}
}
/// <summary>
/// Gets the font size of the read font property.
/// 0 for default font size
/// </summary>
public double FontSize
{
get
{
if( _defaultFont.Length > 0)
{
string [] fontSplit = _defaultFont.Split( new char[]{','});
if(fontSplit.Length > 1)
return double.Parse(fontSplit[1].Trim());
}
return 0.0;
}
}
/// <summary>
/// Gets the character set of the read font property
/// 1 for default
/// </summary>
public int CharacterSet
{
get
{
if( _defaultFont.Length > 0)
{
string [] fontSplit = _defaultFont.Split( new char[]{','});
if(fontSplit.Length > 2)
return Int32.Parse(fontSplit[2].Trim());
}
return 0;
}
}
/// <summary>
/// Gets the codepage depending on the read font property
/// </summary>
public int CodePage
{
get
{
// if we've read a LCID from the system file
// ignore the font-property settings and return
// the codepage generated from the culture info
if(_culture != null)
{
return _culture.TextInfo.ANSICodePage;
}
int nRet = 1252; // default codepage windows-1252
int nCSet = CharacterSet;
switch(nCSet)
{
case 0x00: nRet = 1252;break; // ANSI_CHARSET
case 0xCC: nRet = 1251;break; // RUSSIAN_CHARSET
case 0xEE: nRet = 1250;break; // EE_CHARSET
case 0xA1: nRet = 1253;break; // GREEK_CHARSET
case 0xA2: nRet = 1254;break; // TURKISH_CHARSET
case 0xBA: nRet = 1257;break; // BALTIC_CHARSET
case 0xB1: nRet = 1255;break; // HEBREW_CHARSET
case 0xB2: nRet = 1256;break; // ARABIC_CHARSET
case 0x80: nRet = 932;break; // SHIFTJIS_CHARSET
case 0x81: nRet = 949;break; // HANGEUL_CHARSET
case 0x86: nRet = 936;break; // GB2313_CHARSET
case 0x88: nRet = 950;break; // CHINESEBIG5_CHARSET
}
return nRet;
}
}
/// <summary>
/// Gets the assiciated culture info
/// </summary>
public CultureInfo Culture
{
get { return _culture; }
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,288 +0,0 @@
using System;
using System.IO;
using System.Collections;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMTocidx</c> implements functions to decode the #TOCIDX internal file.
/// </summary>
internal sealed class CHMTocidx : IDisposable
{
/// <summary>
/// Constant specifying the size of the data blocks
/// </summary>
private const int BLOCK_SIZE = 0x1000;
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal memebr storing the offset to the 20/28 byte structs
/// </summary>
private int _offset2028 = 0;
/// <summary>
/// Internal member storing the offset to the 16 byte structs
/// </summary>
private int _offset16structs = 0;
/// <summary>
/// Internal member storing the number of 16 byte structs
/// </summary>
private int _numberOf16structs = 0;
/// <summary>
/// Internal member storing the offset to the topic list
/// </summary>
private int _offsetOftopics = 0;
/// <summary>
/// Internal member storing the toc
/// </summary>
private ArrayList _toc = new ArrayList();
/// <summary>
/// Internal member for offset seeking
/// </summary>
private Hashtable _offsetTable = new Hashtable();
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #TOCIDX file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMTocidx(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
// clear internal binary data after extraction
_binaryFileData = null;
}
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
_toc = new ArrayList();
_offsetTable = new Hashtable();
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nCurOffset = 0;
_offset2028 = binReader.ReadInt32();
_offset16structs = binReader.ReadInt32();
_numberOf16structs = binReader.ReadInt32();
_offsetOftopics = binReader.ReadInt32();
binReader.BaseStream.Seek( _offset2028, SeekOrigin.Begin );
if( RecursivelyBuildTree(ref binReader, _offset2028, _toc, null) )
{
binReader.BaseStream.Seek( _offset16structs, SeekOrigin.Begin );
nCurOffset = (int)binReader.BaseStream.Position;
for(int i=0; i < _numberOf16structs; i++)
{
int tocOffset = binReader.ReadInt32();
int sqNr = binReader.ReadInt32();
int topOffset = binReader.ReadInt32();
int hhctopicIdx = binReader.ReadInt32();
nCurOffset = (int)binReader.BaseStream.Position;
int topicIdx = -1;
// if the topic offset is within the range of the stream
// and is >= the offset of the first topic dword
if((topOffset < (binReader.BaseStream.Length - 4)) && (topOffset >= _offsetOftopics))
{
// read the index of the topic for this item
binReader.BaseStream.Seek( topOffset, SeekOrigin.Begin);
topicIdx = binReader.ReadInt32();
binReader.BaseStream.Seek( nCurOffset, SeekOrigin.Begin);
TOCItem item = (TOCItem)_offsetTable[tocOffset.ToString()];
if( item != null)
{
if(( topicIdx < _associatedFile.TopicsFile.TopicTable.Count)&&(topicIdx>=0))
{
TopicEntry te = (TopicEntry) (_associatedFile.TopicsFile.TopicTable[topicIdx]);
if( (te != null) && (item.TopicOffset < 0) )
{
item.TopicOffset = te.EntryOffset;
}
}
}
}
}
}
return bRet;
}
/// <summary>
/// Recursively reads the binary toc tree from the file
/// </summary>
/// <param name="binReader">reference to binary reader</param>
/// <param name="NodeOffset">offset of the first node in the current level</param>
/// <param name="level">arraylist of TOCItems for the current level</param>
/// <param name="parentItem">parent item for the item</param>
/// <returns>Returns true if succeeded</returns>
private bool RecursivelyBuildTree(ref BinaryReader binReader, int NodeOffset, ArrayList level, TOCItem parentItem)
{
bool bRet = true;
int nextOffset=0;
int nReadOffset = (int)binReader.BaseStream.Position;
binReader.BaseStream.Seek(NodeOffset, SeekOrigin.Begin);
do
{
int nCurOffset = (int)binReader.BaseStream.Position;
int unkn1 = binReader.ReadInt16(); // unknown
int unkn2 = binReader.ReadInt16(); // unknown
int flag = binReader.ReadInt32();
int nFolderAdd = 0;
if((_associatedFile != null) && (_associatedFile.ImageTypeFolder))
{
// get the value which should be added, to display folders instead of books
if(HtmlHelpSystem.UseHH2TreePics)
nFolderAdd = 8;
else
nFolderAdd = 4;
}
int nFolderImgIdx = (HtmlHelpSystem.UseHH2TreePics ? (TOCItem.STD_FOLDER_HH2+nFolderAdd) : (TOCItem.STD_FOLDER_HH1+nFolderAdd));
int nFileImgIdx = (HtmlHelpSystem.UseHH2TreePics ? TOCItem.STD_FILE_HH2 : TOCItem.STD_FILE_HH1);
int stdImage = ((flag & 0x4)!=0) ? nFolderImgIdx : nFileImgIdx;
int stringOffset = binReader.ReadInt32();
int ParentOffset = binReader.ReadInt32();
nextOffset = binReader.ReadInt32();
int firstChildOffset = 0;
int unkn3=0;
if( (flag&0x4)!=0 )
{
firstChildOffset = binReader.ReadInt32();
unkn3 = binReader.ReadInt32(); // unknown
}
TOCItem newItem = new TOCItem();
newItem.ImageIndex = stdImage;
newItem.Offset = nCurOffset;
newItem.OffsetNext = nextOffset;
newItem.AssociatedFile = _associatedFile;
newItem.TocMode = DataMode.Binary;
newItem.Parent = parentItem;
if( (flag&0x08) == 0)
{
// toc item doesn't have a local value (=> stringOffset = offset of strings file)
newItem.Name = _associatedFile.StringsFile[stringOffset];
}
else
{
// this item has a topic entry (=> stringOffset = index of topic entry)
if((stringOffset < _associatedFile.TopicsFile.TopicTable.Count) && (stringOffset >= 0))
{
TopicEntry te = (TopicEntry) (_associatedFile.TopicsFile.TopicTable[stringOffset]);
if(te != null)
{
newItem.TopicOffset = te.EntryOffset;
}
}
}
_offsetTable[nCurOffset.ToString()] = newItem;
// if this item has children (firstChildOffset > 0)
if( firstChildOffset > 0)
{
bRet &= RecursivelyBuildTree(ref binReader, firstChildOffset, newItem.Children, newItem);
}
level.Add( newItem );
if(nCurOffset != nextOffset)
binReader.BaseStream.Seek(nextOffset, SeekOrigin.Begin);
}while(nextOffset != 0);
binReader.BaseStream.Seek(nReadOffset, SeekOrigin.Begin);
return bRet;
}
/// <summary>
/// Gets the internal read toc
/// </summary>
internal ArrayList TOC
{
get { return _toc; }
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_toc = null;
_offsetTable = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,235 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMTopics</c> implements functionality to decode the #TOPICS internal file
/// </summary>
internal sealed class CHMTopics : IDisposable
{
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Internal member storing the topic list
/// </summary>
private ArrayList _topicTable = new ArrayList();
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #TOPICS file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMTopics(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
// clear internal binary data after extraction
_binaryFileData = null;
}
/// <summary>
/// Standard constructor
/// </summary>
internal CHMTopics()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _topicTable.Count );
foreach(TopicEntry curItem in _topicTable)
{
curItem.Dump(ref writer);
}
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
int i=0;
int nCnt = reader.ReadInt32();
for(i=0; i<nCnt;i++)
{
TopicEntry newItem = new TopicEntry();
newItem.SetCHMFile(_associatedFile);
newItem.ReadDump(ref reader);
_topicTable.Add(newItem);
}
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
foreach(TopicEntry curEntry in _topicTable)
{
curEntry.SetCHMFile(associatedFile);
}
}
#endregion
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nCurOffset = 0;
while( (memStream.Position < memStream.Length) && (bRet) )
{
int entryOffset = nCurOffset;
int tocIdx = binReader.ReadInt32();
int titleOffset = binReader.ReadInt32();
int urltablOffset = binReader.ReadInt32();
int visibilityMode = binReader.ReadInt16();
int unknownMode = binReader.ReadInt16();
TopicEntry newEntry = new TopicEntry(entryOffset, tocIdx, titleOffset, urltablOffset, visibilityMode, unknownMode, _associatedFile);
_topicTable.Add( newEntry );
nCurOffset = (int)memStream.Position;
}
return bRet;
}
/// <summary>
/// Gets the arraylist containing all topic entries.
/// </summary>
public ArrayList TopicTable
{
get
{
return _topicTable;
}
}
/// <summary>
/// Gets the topic entry of a given offset
/// </summary>
public TopicEntry this[int offset]
{
get
{
foreach(TopicEntry curEntry in _topicTable)
if(curEntry.EntryOffset == offset)
return curEntry;
return null;
}
}
/// <summary>
/// Searches a topic by the locale name
/// </summary>
/// <param name="locale">locale name to search</param>
/// <returns>The topicentry instance if found, otherwise null</returns>
public TopicEntry GetByLocale(string locale)
{
foreach(TopicEntry curEntry in TopicTable)
{
if(curEntry.Locale.ToLower() == locale.ToLower())
return curEntry;
}
return null;
}
/// <summary>
/// Searches the topics for all files with a given file extension
/// </summary>
/// <param name="fileExtension">extension to search</param>
/// <returns>An arraylist of TopicEntry instances or null if no topic was found</returns>
public ArrayList GetByExtension(string fileExtension)
{
ArrayList arrRet = new ArrayList();
foreach(TopicEntry curEntry in TopicTable)
{
if(curEntry.Locale.ToLower().EndsWith(fileExtension.ToLower()))
arrRet.Add(curEntry);
}
if(arrRet.Count > 0)
return arrRet;
return null;
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_topicTable=null;
}
}
disposed = true;
}
}
}

View File

@@ -1,308 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Specialized;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMUrlstr</c> implements a string collection storing the URL strings of the help file
/// </summary>
internal sealed class CHMUrlstr : IDisposable
{
/// <summary>
/// Constant specifying the size of the string blocks
/// </summary>
private const int BLOCK_SIZE = 0x1000;
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the url dictionary
/// </summary>
private Hashtable _urlDictionary = new Hashtable();
/// <summary>
/// Internal member storing the framename dictionary
/// </summary>
private Hashtable _framenameDictionary = new Hashtable();
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #URLSTR file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMUrlstr(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
// clear internal binary data after extraction
_binaryFileData = null;
}
/// <summary>
/// Standard constructor
/// </summary>
internal CHMUrlstr()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _urlDictionary.Count );
if (_urlDictionary.Count != 0)
{
IDictionaryEnumerator iDictionaryEnumerator = _urlDictionary.GetEnumerator();
while (iDictionaryEnumerator.MoveNext())
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)iDictionaryEnumerator.Current;
writer.Write( Int32.Parse(dictionaryEntry.Key.ToString()) );
writer.Write( dictionaryEntry.Value.ToString() );
}
}
writer.Write( _framenameDictionary.Count );
if (_framenameDictionary.Count != 0)
{
IDictionaryEnumerator iDictionaryEnumerator = _framenameDictionary.GetEnumerator();
while (iDictionaryEnumerator.MoveNext())
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)iDictionaryEnumerator.Current;
writer.Write( Int32.Parse(dictionaryEntry.Key.ToString()) );
writer.Write( dictionaryEntry.Value.ToString() );
}
}
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
int i=0;
int nCnt = reader.ReadInt32();
for(i=0; i<nCnt;i++)
{
int nKey = reader.ReadInt32();
string sValue = reader.ReadString();
_urlDictionary[nKey.ToString()] = sValue;
}
nCnt = reader.ReadInt32();
for(i=0; i<nCnt;i++)
{
int nKey = reader.ReadInt32();
string sValue = reader.ReadString();
_framenameDictionary[nKey.ToString()] = sValue;
}
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
}
#endregion
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nCurOffset = 0;
while( (memStream.Position < memStream.Length) && (bRet) )
{
nCurOffset = (int)memStream.Position;
byte [] dataBlock = binReader.ReadBytes(BLOCK_SIZE);
bRet &= DecodeBlock(dataBlock, ref nCurOffset);
}
return bRet;
}
/// <summary>
/// Decodes a block of url-string data
/// </summary>
/// <param name="dataBlock">block of data</param>
/// <param name="nOffset">current file offset</param>
/// <returns>true if succeeded</returns>
private bool DecodeBlock( byte[] dataBlock, ref int nOffset )
{
bool bRet = true;
int blockOffset = nOffset;
MemoryStream memStream = new MemoryStream(dataBlock);
BinaryReader binReader = new BinaryReader(memStream);
if(nOffset==0)
binReader.ReadByte(); // first block starts with an unknown byte
while( (memStream.Position < (memStream.Length-8)) && (bRet) )
{
int entryOffset = blockOffset + (int)memStream.Position;
int urlOffset = binReader.ReadInt32();
int frameOffset = binReader.ReadInt32();
// There is one way to tell where the end of the URL/FrameName
// pairs occurs: Repeat the following: read 2 DWORDs and if both
// are less than the current offset then this is the start of the Local
// strings else skip two NT strings.
// if(( (urlOffset < (entryOffset+8)) && (frameOffset < (entryOffset+8)) ))
// {
// //TODO: add correct string reading if an offset has been found
// /*
// int curOffset = (int)memStream.Position;
//
// memStream.Seek( (long)(blockOffset-urlOffset), SeekOrigin.Begin);
// string sTemp = CHMReader.ExtractString(ref binReader, 0, true);
//
// memStream.Seek( (long)(blockOffset-frameOffset), SeekOrigin.Begin);
// sTemp = CHMReader.ExtractString(ref binReader, 0, true);
//
// memStream.Seek((long)curOffset, SeekOrigin.Begin);
// */
//
//
// int curOffs = (int)memStream.Position;
// BinaryReaderHelp.ExtractString(ref binReader, 0, true, _associatedFile.TextEncoding);
// nOffset += (int)memStream.Position - curOffs;
//
// curOffs = (int)memStream.Position;
// BinaryReaderHelp.ExtractString(ref binReader, 0, true, _associatedFile.TextEncoding);
// nOffset += (int)memStream.Position - curOffs;
// }
// else
{
bool bFoundTerminator = false;
string sTemp = BinaryReaderHelp.ExtractString(ref binReader, ref bFoundTerminator, 0, true, _associatedFile.TextEncoding);
if(sTemp == "")
{
//nOffset = nOffset + 1 + (int)memStream.Length - (int)memStream.Position;
memStream.Seek(memStream.Length-1, SeekOrigin.Begin);
}
else
{
_urlDictionary[entryOffset.ToString()] = sTemp.ToString();
_framenameDictionary[ entryOffset.ToString() ] = sTemp.ToString() ;
}
}
}
return bRet;
}
/// <summary>
/// Gets the url at a given offset
/// </summary>
/// <param name="offset">offset of url</param>
/// <returns>the url at the given offset</returns>
public string GetURLatOffset(int offset)
{
if(offset == -1)
return String.Empty;
string sTemp = (string)_urlDictionary[ offset.ToString() ];
if(sTemp == null)
return String.Empty;
return sTemp;
}
/// <summary>
/// Gets the framename at a given offset
/// </summary>
/// <param name="offset">offset of the framename</param>
/// <returns>the frame name at the given offset</returns>
public string GetFrameNameatOffset(int offset)
{
if(offset == -1)
return String.Empty;
string sTemp = (string)_framenameDictionary[ offset.ToString() ];
if(sTemp == null)
return String.Empty;
return sTemp;
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_urlDictionary = null;
_framenameDictionary = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,245 +0,0 @@
using System;
using System.IO;
using System.Collections;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>CHMUrltable</c> implements methods to decode the #URLTBL internal file.
/// </summary>
internal sealed class CHMUrltable : IDisposable
{
/// <summary>
/// Constant specifying the size of the data blocks
/// </summary>
private const int BLOCK_SIZE = 0x1000;
/// <summary>
/// Constant specifying the number of records per block
/// </summary>
private const int RECORDS_PER_BLOCK = 341;
/// <summary>
/// Internal flag specifying if the object is going to be disposed
/// </summary>
private bool disposed = false;
/// <summary>
/// Internal member storing the binary file data
/// </summary>
private byte[] _binaryFileData = null;
/// <summary>
/// Internal member storing the url table
/// </summary>
private ArrayList _urlTable = new ArrayList();
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="binaryFileData">binary file data of the #URLTBL file</param>
/// <param name="associatedFile">associated chm file</param>
public CHMUrltable(byte[] binaryFileData, CHMFile associatedFile)
{
_binaryFileData = binaryFileData;
_associatedFile = associatedFile;
DecodeData();
// clear internal binary data after extraction
_binaryFileData = null;
}
/// <summary>
/// Standard constructor
/// </summary>
internal CHMUrltable()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _urlTable.Count );
foreach(UrlTableEntry curItem in _urlTable)
{
curItem.Dump(ref writer);
}
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
int i=0;
int nCnt = reader.ReadInt32();
for(i=0; i<nCnt;i++)
{
UrlTableEntry newItem = new UrlTableEntry();
newItem.SetCHMFile(_associatedFile);
newItem.ReadDump(ref reader);
_urlTable.Add(newItem);
}
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
foreach(UrlTableEntry curEntry in _urlTable)
{
curEntry.SetCHMFile(associatedFile);
}
}
#endregion
/// <summary>
/// Decodes the binary file data and fills the internal properties
/// </summary>
/// <returns>true if succeeded</returns>
private bool DecodeData()
{
bool bRet = true;
MemoryStream memStream = new MemoryStream(_binaryFileData);
BinaryReader binReader = new BinaryReader(memStream);
int nCurOffset = 0;
while( (memStream.Position < memStream.Length) && (bRet) )
{
nCurOffset = (int)memStream.Position;
byte [] dataBlock = binReader.ReadBytes(BLOCK_SIZE);
bRet &= DecodeBlock(dataBlock, ref nCurOffset);
}
return bRet;
}
/// <summary>
/// Decodes a block of url-string data
/// </summary>
/// <param name="dataBlock">block of data</param>
/// <param name="nOffset">current file offset</param>
/// <returns>true if succeeded</returns>
private bool DecodeBlock( byte[] dataBlock, ref int nOffset )
{
bool bRet = true;
int blockOffset = nOffset;
MemoryStream memStream = new MemoryStream(dataBlock);
BinaryReader binReader = new BinaryReader(memStream);
for(int i=0; i < RECORDS_PER_BLOCK; i++)
{
int recordOffset = blockOffset + (int)memStream.Position;
uint nuniqueID = (uint) binReader.ReadInt32(); // unknown dword
int ntopicsIdx = binReader.ReadInt32();
int urlstrOffset = binReader.ReadInt32();
UrlTableEntry newEntry = new UrlTableEntry(nuniqueID, recordOffset, ntopicsIdx, urlstrOffset, _associatedFile);
_urlTable.Add(newEntry);
if( memStream.Position >= memStream.Length)
break;
}
if(dataBlock.Length == BLOCK_SIZE)
binReader.ReadInt32();
return bRet;
}
/// <summary>
/// Gets the arraylist containing all urltable entries.
/// </summary>
public ArrayList UrlTable
{
get
{
return _urlTable;
}
}
/// <summary>
/// Gets the urltable entry of a given offset
/// </summary>
public UrlTableEntry this[int offset]
{
get
{
foreach(UrlTableEntry curEntry in _urlTable)
if(curEntry.EntryOffset == offset)
return curEntry;
return null;
}
}
/// <summary>
/// Gets the urltable entry of a given uniqueID
/// </summary>
public UrlTableEntry GetByUniqueID(uint uniqueID)
{
foreach(UrlTableEntry curEntry in UrlTable)
{
if(curEntry.UniqueID == uniqueID)
return curEntry;
}
return null;
}
/// <summary>
/// Implement IDisposable.
/// </summary>
public void Dispose()
{
Dispose(true);
// This object will be cleaned up by the Dispose method.
// Therefore, you should call GC.SupressFinalize to
// take this object off the finalization queue
// and prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose(bool disposing) executes in two distinct scenarios.
/// If disposing equals true, the method has been called directly
/// or indirectly by a user's code. Managed and unmanaged resources
/// can be disposed.
/// If disposing equals false, the method has been called by the
/// runtime from inside the finalizer and you should not reference
/// other objects. Only unmanaged resources can be disposed.
/// </summary>
/// <param name="disposing">disposing flag</param>
private void Dispose(bool disposing)
{
// Check to see if Dispose has already been called.
if(!this.disposed)
{
// If disposing equals true, dispose all managed
// and unmanaged resources.
if(disposing)
{
// Dispose managed resources.
_binaryFileData = null;
_urlTable = null;
}
}
disposed = true;
}
}
}

View File

@@ -1,395 +0,0 @@
using System;
using System.IO;
using System.Text;
using System.Diagnostics;
using System.Collections.Specialized;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using HtmlHelp;
// using HtmlHelp.Storage;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// Enumeration for specifying the dumping compression
/// </summary>
public enum DumpCompression
{
/// <summary>
/// None - no data compression will be used.
/// Fastest but most memory intensive
/// </summary>
None = 0,
/// <summary>
/// Minimum - a minimum data compression will be used.
/// Fast but not much data reduction
/// </summary>
Minimum = 1,
/// <summary>
/// Medium - a medium data compression will be used.
/// Slower but medium data reduction
/// </summary>
Medium = 2,
/// <summary>
/// Maximum - a maximum data compression will be used.
/// Slowest but maximum data reduction
/// </summary>
Maximum = 3
}
/// <summary>
/// Flags which specify which data should be dumped
/// </summary>
[FlagsAttribute()]
public enum DumpingFlags
{
/// <summary>
/// DumpTextTOC - if this flag is set, text-based TOCs (sitemap format) will be dumped
/// </summary>
DumpTextTOC = 1,
/// <summary>
/// DumpBinaryTOC - if this flag is set, binary TOCs will be dumped
/// </summary>
DumpBinaryTOC = 2,
/// <summary>
/// DumpTextIndex - if this flag is set, the text-based index (sitemap format) will be dumped
/// </summary>
DumpTextIndex = 4,
/// <summary>
/// DumpBinaryIndex - if this flag is set, the binary index will be dumped
/// </summary>
DumpBinaryIndex = 8,
/// <summary>
/// DumpStrings - if this flag is set, the internal #STRINGS file will be dumped
/// </summary>
DumpStrings = 16,
/// <summary>
/// DumpUrlStr - if this flag is set, the internal #URLSTR file will be dumped
/// </summary>
DumpUrlStr = 32,
/// <summary>
/// DumpUrlTbl - if this flag is set, the internal #URLTBL file will be dumped
/// </summary>
DumpUrlTbl = 64,
/// <summary>
/// DumpTopics - if this flag is set, the internal #TOPICS file will be dumped
/// </summary>
DumpTopics = 128,
/// <summary>
/// DumpFullText - if this flag is set, the internal $FIftiMain file will be dumped
/// </summary>
DumpFullText = 256
}
/// <summary>
/// The class <c>DumpingInfo</c> implements information properties for the CHMFile class
/// if and how data dumping should be used.
/// </summary>
public sealed class DumpingInfo
{
public bool m_bAllowSaveDump=true;
private readonly static BitVector32.Section DumpFlags = BitVector32.CreateSection(512);
private const string _dumpHeader = "HtmlHelpSystem dump file 1.0";
private string _outputDir = ""; // emtpy string means, same directory as chm file
private DumpCompression _compressionLevel = DumpCompression.Maximum;
private CHMFile _chmFile = null;
private DeflaterOutputStream _outputStream = null;
private InflaterInputStream _inputStream = null;
private BinaryWriter _writer = null;
private BinaryReader _reader = null;
private BitVector32 _flags;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="flags">Combine flag values to specify which data should be dumped.</param>
/// <param name="outputDir">output directory. emtpy string means,
/// same directory as chm file (only if destination = ExternalFile)</param>
/// <param name="compressionLevel">compression which should be used</param>
public DumpingInfo(DumpingFlags flags, string outputDir, DumpCompression compressionLevel)
{
_flags = new BitVector32(0);
int i = _flags[DumpFlags];
_flags[DumpFlags] = i | (int)flags;
_outputDir = outputDir;
_compressionLevel = compressionLevel;
}
/// <summary>
/// Gets the flag if text-based TOCs will be written to the dumping file
/// </summary>
public bool DumpTextTOC
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpTextTOC) != 0); }
}
/// <summary>
/// Gets the flag if binary TOCs will be written to the dumping file
/// </summary>
public bool DumpBinaryTOC
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpBinaryTOC) != 0); }
}
/// <summary>
/// Gets the flag if the text-based index will be written to the dumping file
/// </summary>
public bool DumpTextIndex
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpTextIndex) != 0); }
}
/// <summary>
/// Gets the flag if the binary index will be written to the dumping file
/// </summary>
public bool DumpBinaryIndex
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpBinaryIndex) != 0); }
}
/// <summary>
/// Gets the flag if the #STRINGS file will be written to the dumping file
/// </summary>
public bool DumpStrings
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpStrings) != 0); }
}
/// <summary>
/// Gets the flag if the #URLSTR file will be written to the dumping file
/// </summary>
public bool DumpUrlStr
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpUrlStr) != 0); }
}
/// <summary>
/// Gets the flag if the #URLTBL file will be written to the dumping file
/// </summary>
public bool DumpUrlTbl
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpUrlTbl) != 0); }
}
/// <summary>
/// Gets the flag if the #TOPICS file will be written to the dumping file
/// </summary>
public bool DumpTopics
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpTopics) != 0); }
}
/// <summary>
/// Gets the flag if the $FIftiMain file will be written to the dumping file
/// </summary>
public bool DumpFullText
{
get { return ((_flags[DumpFlags] & (int)DumpingFlags.DumpFullText) != 0); }
}
/// <summary>
/// Gets the dump output directory.
/// </summary>
/// <value>emtpy string means, same directory as chm file</value>
/// <remarks>If Destination is set to DumpingOutput.InternalFile this property will be ignored</remarks>
public string OutputDir
{
get { return _outputDir; }
}
/// <summary>
/// The compression level used.
/// </summary>
public DumpCompression CompressionLevel
{
get { return _compressionLevel; }
}
/// <summary>
/// Gets/Sets the CHMFile instance associated with this object
/// </summary>
internal CHMFile ChmFile
{
get { return _chmFile; }
set { _chmFile = value; }
}
/// <summary>
/// Translates the compression level to the deflater constants
/// </summary>
private int CompLvl
{
get
{
switch(CompressionLevel)
{
case DumpCompression.None: return Deflater.NO_COMPRESSION;
case DumpCompression.Minimum: return Deflater.BEST_SPEED;
case DumpCompression.Medium: return Deflater.DEFAULT_COMPRESSION;
case DumpCompression.Maximum: return Deflater.BEST_COMPRESSION;
}
return Deflater.BEST_COMPRESSION;
}
}
/// <summary>
/// Checks if a dump exists
/// </summary>
internal bool DumpExists
{
get
{
if(_flags[DumpFlags] == 0)
return false;
// we have a reader or writer to the dump so it must exist
if( (_reader != null) || (_writer != null) )
return true;
string sDmpFile = _chmFile.ChmFilePath;
sDmpFile=sDmpFile.ToLower().Replace(".chm",".CHB");
return File.Exists(sDmpFile);
}
}
/// <summary>
/// Gets a binary writer instance which allows you to write to the dump
/// </summary>
internal BinaryWriter Writer
{
get
{
if (m_bAllowSaveDump==false)
return null;
if(_flags[DumpFlags] == 0)
throw new InvalidOperationException("Nothing to dump. No flags have been set !");
if(_reader != null)
throw new InvalidOperationException("Can't write and read at the same time !");
if(_chmFile == null)
throw new InvalidOperationException("Only usable with an associated CHMFile instance !");
if(_writer==null)
{
string sDmpFile = _chmFile.ChmFilePath;
sDmpFile=sDmpFile.ToLower().Replace(".chm",".CHB");
StreamWriter stream = new StreamWriter(sDmpFile, false, _chmFile.TextEncoding);
// write header info uncompressed
BinaryWriter _hwriter = new BinaryWriter(stream.BaseStream);
_hwriter.Write(_dumpHeader);
_hwriter.Write((int)CompressionLevel);
if(_compressionLevel == DumpCompression.None)
{
_writer = new BinaryWriter(stream.BaseStream);
}
else
{
_outputStream = new DeflaterOutputStream(stream.BaseStream, new Deflater(CompLvl));
_writer = new BinaryWriter(_outputStream);
}
}
return _writer;
}
}
/// <summary>
/// Gets a binary reader which allows you to read from the dump
/// </summary>
internal BinaryReader Reader
{
get
{
if(_writer != null)
throw new InvalidOperationException("Can't write and read at the same time !");
if(_chmFile == null)
throw new InvalidOperationException("Only usable with an associated CHMFile instance !");
if(_reader==null)
{
string sDmpFile = _chmFile.ChmFilePath;
sDmpFile=sDmpFile.ToLower().Replace(".chm",".CHB");
StreamReader stream = new StreamReader(sDmpFile, _chmFile.TextEncoding);
BinaryReader _hReader = new BinaryReader(stream.BaseStream);
string sH = _hReader.ReadString();
if(sH != _dumpHeader)
{
_hReader.Close();
Debug.WriteLine("Unexpected dump-file header !");
throw new FormatException("DumpingInfo.Reader - Unexpected dump-file header !");
}
_compressionLevel = (DumpCompression)_hReader.ReadInt32();
// if(_compressionLevel != (DumpCompression)_hReader.ReadInt32())
// {
// _hReader.Close();
// return null;
// }
if(_compressionLevel == DumpCompression.None)
{
_reader = new BinaryReader(stream.BaseStream);
}
else
{
_inputStream = new InflaterInputStream(stream.BaseStream, new Inflater());
_reader = new BinaryReader(_inputStream);
}
}
return _reader;
}
}
/// <summary>
/// Saves data and closes the dump
/// </summary>
/// <returns>true if succeed</returns>
internal bool SaveData()
{
if (m_bAllowSaveDump==false)
return true;
if(_writer != null)
{
if(_writer!=null)
_writer.Close();
_outputStream = null;
_writer = null;
}
if(_reader != null)
{
if(_reader!=null)
_reader.Close();
_inputStream = null;
_reader = null;
}
return true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,593 +0,0 @@
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>HHCParser</c> implements a parser for HHC contents files.
/// </summary>
internal sealed class HHCParser
{
/// <summary>
/// regular expressions for replacing the sitemap boundary tags
/// </summary>
private static string RE_ULOpening = @"\<ul\>"; // will be replaced by a '(' for nested parsing
private static string RE_ULClosing = @"\</ul\>"; // will be replaced by a ')' for nested parsing
/// <summary>
/// Matching ul-tags
/// </summary>
private static string RE_ULBoundaries = @"\<ul\>(?<innerText>.*)\</ul\>";
/// <summary>
/// Matching the nested tree structure.
/// </summary>
private static string RE_NestedBoundaries = @"\( (?> [^()]+ | \( (?<DEPTH>) | \) (?<-DEPTH>) )* (?(DEPTH)(?!)) \)";
/// <summary>
/// Matching object-tags
/// </summary>
private static string RE_ObjectBoundaries = @"\<object(?<innerText>.*?)\</object\>";
/// <summary>
/// Matching param tags
/// </summary>
private static string RE_ParamBoundaries = @"\<param(?<innerText>.*?)\>";
/// <summary>
/// Extracting tag attributes
/// </summary>
private const string RE_QuoteAttributes = @"( |\t)*(?<attributeName>[\-a-zA-Z0-9]*)( |\t)*=( |\t)*(?<attributeTD>[\""\'])?(?<attributeValue>.*?(?(attributeTD)\k<attributeTD>|([\s>]|.$)))";
/// <summary>
/// private regular expressionobjects
/// </summary>
private static Regex ulRE;
private static Regex NestedRE;
private static Regex ObjectRE;
private static Regex ParamRE;
private static Regex AttributesRE;
/// <summary>
/// Internal member storing the list of TOCItems which are holding merge links
/// </summary>
private static ArrayList _mergeItems = null;
/// <summary>
/// Internal member storing the last read regular topic item.
/// This is used to handle "Merge" entries and add them as child to this instance.
/// </summary>
private static TOCItem _lastTopicItem = null;
/// <summary>
/// Parses a HHC file and returns an ArrayList with the table of contents (TOC) tree
/// </summary>
/// <param name="hhcFile">string content of the hhc file</param>
/// <param name="chmFile">CHMFile instance</param>
/// <returns>Returns an ArrayList with the table of contents (TOC) tree</returns>
public static ArrayList ParseHHC(string hhcFile, CHMFile chmFile)
{
_lastTopicItem = null;
_mergeItems = null; // clear merged item list
ArrayList tocList = new ArrayList();
ulRE = new Regex(RE_ULBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
NestedRE = new Regex(RE_NestedBoundaries, RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ObjectRE = new Regex(RE_ObjectBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ParamRE = new Regex(RE_ParamBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
AttributesRE = new Regex(RE_QuoteAttributes, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
int innerTextIdx = ulRE.GroupNumberFromName("innerText");
if( ulRE.IsMatch(hhcFile, 0) )
{
Match m = ulRE.Match(hhcFile, 0);
int nFirstUL = 0;
nFirstUL = hhcFile.ToLower().IndexOf("<ul>");
if(nFirstUL == -1)
nFirstUL = hhcFile.ToLower().IndexOf("<il>");
if( ObjectRE.IsMatch(hhcFile, 0) ) // first object block contains information types and categories
{
Match mO = ObjectRE.Match(hhcFile, 0);
int iOTxt = ObjectRE.GroupNumberFromName("innerText");
string globalText = mO.Groups[iOTxt].Value;
if( mO.Groups[iOTxt].Index <= nFirstUL)
ParseGlobalSettings( globalText, chmFile );
}
// parse toc tree
string innerText = m.Groups["innerText"].Value;
innerText = innerText.Replace("(", "&#040;");
innerText = innerText.Replace(")", "&#041;");
innerText = Regex.Replace(innerText, RE_ULOpening, "(", RegexOptions.IgnoreCase);
innerText = Regex.Replace(innerText, RE_ULClosing, ")", RegexOptions.IgnoreCase);
ParseTree( innerText, null, tocList, chmFile );
}
return tocList;
}
/// <summary>
/// Checks if the hhc file contains a global object tag.
/// </summary>
/// <param name="hhcFile">string content of the hhc file</param>
/// <param name="chmFile">chm file</param>
/// <returns>true if the hhc content contains a global object tag</returns>
public static bool HasGlobalObjectTag(string hhcFile, CHMFile chmFile)
{
bool bRet = false;
ulRE = new Regex(RE_ULBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ObjectRE = new Regex(RE_ObjectBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
int innerTextIdx = ulRE.GroupNumberFromName("innerText");
if( ulRE.IsMatch(hhcFile, 0) )
{
Match m = ulRE.Match(hhcFile, 0);
int nFirstUL = 0;
nFirstUL = hhcFile.ToLower().IndexOf("<ul>");
if(nFirstUL == -1)
nFirstUL = hhcFile.ToLower().IndexOf("<il>");
if( ObjectRE.IsMatch(hhcFile, 0) ) // first object block contains information types and categories
{
Match mO = ObjectRE.Match(hhcFile, 0);
int iOTxt = ObjectRE.GroupNumberFromName("innerText");
string globalText = mO.Groups[iOTxt].Value;
if( mO.Groups[iOTxt].Index <= nFirstUL)
bRet = true;
}
}
return bRet;
}
/// <summary>
/// Gets true if the previously done parsing found merge-links
/// </summary>
public static bool HasMergeLinks
{
get
{
if(_mergeItems==null)
return false;
return _mergeItems.Count > 0;
}
}
/// <summary>
/// Gets all TOCItem references which are holding merge-links
/// </summary>
public static ArrayList MergeItems
{
get { return _mergeItems; }
}
/// <summary>
/// Recursively parses a sitemap tree
/// </summary>
/// <param name="text">content text</param>
/// <param name="parent">Parent for all read items</param>
/// <param name="arrNodes">arraylist which receives the extracted nodes</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseTree( string text, TOCItem parent, ArrayList arrNodes, CHMFile chmFile )
{
string strPreItems="", strPostItems="";
string innerText = "";
int nIndex = 0;
while( NestedRE.IsMatch(text, nIndex) )
{
Match m = NestedRE.Match(text, nIndex);
innerText = m.Value.Substring( 1, m.Length-2);
strPreItems = text.Substring(nIndex,m.Index-nIndex);
ParseItems(strPreItems, parent, arrNodes, chmFile);
if((arrNodes.Count>0) && (innerText.Length > 0) )
{
TOCItem p = ((TOCItem)(arrNodes[arrNodes.Count-1]));
ParseTree( innerText, p, p.Children, chmFile );
}
nIndex = m.Index+m.Length;
}
if( nIndex == 0)
{
strPostItems = text.Substring(nIndex, text.Length-nIndex);
ParseItems(strPostItems, parent, arrNodes, chmFile);
}
else if( nIndex < text.Length-1)
{
strPostItems = text.Substring(nIndex, text.Length-nIndex);
ParseTree(strPostItems, parent, arrNodes, chmFile);
}
}
/// <summary>
/// Parses tree nodes from the text
/// </summary>
/// <param name="itemstext">text containing the items</param>
/// <param name="parent">Parent for all read items</param>
/// <param name="arrNodes">arraylist where the nodes should be added</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseItems( string itemstext, TOCItem parent, ArrayList arrNodes, CHMFile chmFile)
{
int innerTextIdx = ObjectRE.GroupNumberFromName("innerText");
int innerPTextIdx = ParamRE.GroupNumberFromName("innerText");
// get group-name indexes
int nameIndex = AttributesRE.GroupNumberFromName("attributeName");
int valueIndex = AttributesRE.GroupNumberFromName("attributeValue");
int tdIndex = AttributesRE.GroupNumberFromName("attributeTD");
int nObjStartIndex = 0;
while( ObjectRE.IsMatch(itemstext, nObjStartIndex) )
{
Match m = ObjectRE.Match(itemstext, nObjStartIndex);
string innerText = m.Groups[innerTextIdx].Value;
TOCItem tocItem = new TOCItem();
tocItem.TocMode = DataMode.TextBased;
tocItem.AssociatedFile = chmFile;
tocItem.Parent = parent;
// read parameters
int nParamIndex = 0;
while( ParamRE.IsMatch(innerText, nParamIndex) )
{
Match mP = ParamRE.Match(innerText, nParamIndex);
string innerP = mP.Groups[innerPTextIdx].Value;
string paramName = "";
string paramValue = "";
int nAttrIdx = 0;
while( AttributesRE.IsMatch( innerP, nAttrIdx ) )
{
Match mA = AttributesRE.Match(innerP, nAttrIdx);
string attributeName = mA.Groups[nameIndex].Value;
string attributeValue = mA.Groups[valueIndex].Value;
string attributeTD = mA.Groups[tdIndex].Value;
if(attributeTD.Length > 0)
{
// delete the trailing textqualifier
if( attributeValue.Length > 0)
{
int ltqi = attributeValue.LastIndexOf( attributeTD );
if(ltqi >= 0)
{
attributeValue = attributeValue.Substring(0,ltqi);
}
}
}
if( attributeName.ToLower() == "name")
{
paramName = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
}
if( attributeName.ToLower() == "value")
{
paramValue = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
// delete trailing /
while((paramValue.Length>0)&&(paramValue[paramValue.Length-1] == '/'))
paramValue = paramValue.Substring(0,paramValue.Length-1);
}
nAttrIdx = mA.Index+mA.Length;
}
tocItem.Params[paramName] = paramValue;
switch(paramName.ToLower())
{
case "name":
{
tocItem.Name = paramValue;
};break;
case "local":
{
tocItem.Local = paramValue.Replace("../", "").Replace("./", "");
};break;
case "imagenumber":
{
tocItem.ImageIndex = Int32.Parse(paramValue);
tocItem.ImageIndex-=1;
int nFolderAdd = 0;
if((chmFile != null) && (chmFile.ImageTypeFolder))
{
// get the value which should be added, to display folders instead of books
if(HtmlHelpSystem.UseHH2TreePics)
nFolderAdd = 8;
else
nFolderAdd = 4;
}
if(tocItem.ImageIndex%2 != 0)
{
if(tocItem.ImageIndex==1)
tocItem.ImageIndex=0;
}
if(HtmlHelpSystem.UseHH2TreePics)
if( tocItem.ImageIndex == 0)
tocItem.ImageIndex = TOCItem.STD_FOLDER_HH2+nFolderAdd;
};break;
case "merge": // this item contains topics or a full TOC from a merged CHM
{
tocItem.MergeLink = paramValue;
// "register" this item as merge-link
if(_mergeItems==null)
_mergeItems=new ArrayList();
_mergeItems.Add(tocItem);
};break;
case "type": // information type assignment for item
{
tocItem.InfoTypeStrings.Add( paramValue );
};break;
}
nParamIndex = mP.Index+mP.Length;
}
tocItem.ChmFile = chmFile.ChmFilePath;
if(tocItem.MergeLink.Length > 0)
{
if(_lastTopicItem != null)
{
tocItem.Parent = _lastTopicItem;
_lastTopicItem.Children.Add(tocItem);
}
else
arrNodes.Add( tocItem );
}
else
{
_lastTopicItem = tocItem;
arrNodes.Add( tocItem );
}
nObjStartIndex = m.Index+m.Length;
}
}
/// <summary>
/// Parses the very first &lt;OBJECT&gt; tag in the sitemap file and extracts
/// information types and categories.
/// </summary>
/// <param name="sText">text of the object tag</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseGlobalSettings(string sText, CHMFile chmFile)
{
int innerPTextIdx = ParamRE.GroupNumberFromName("innerText");
// get group-name indexes
int nameIndex = AttributesRE.GroupNumberFromName("attributeName");
int valueIndex = AttributesRE.GroupNumberFromName("attributeValue");
int tdIndex = AttributesRE.GroupNumberFromName("attributeTD");
// read parameters
int nParamIndex = 0;
// 0... unknown
// 1... inclusinve info type name
// 2... exclusive info type name
// 3... hidden info type name
// 4... category name
// 5... incl infotype name for category
// 6... excl infotype name for category
// 7... hidden infotype name for category
int prevItem = 0;
string sName = "";
string sDescription = "";
string curCategory = "";
while( ParamRE.IsMatch(sText, nParamIndex) )
{
Match mP = ParamRE.Match(sText, nParamIndex);
string innerP = mP.Groups[innerPTextIdx].Value;
string paramName = "";
string paramValue = "";
int nAttrIdx = 0;
while( AttributesRE.IsMatch( innerP, nAttrIdx ) )
{
Match mA = AttributesRE.Match(innerP, nAttrIdx);
string attributeName = mA.Groups[nameIndex].Value;
string attributeValue = mA.Groups[valueIndex].Value;
string attributeTD = mA.Groups[tdIndex].Value;
if(attributeTD.Length > 0)
{
// delete the trailing textqualifier
if( attributeValue.Length > 0)
{
int ltqi = attributeValue.LastIndexOf( attributeTD );
if(ltqi >= 0)
{
attributeValue = attributeValue.Substring(0,ltqi);
}
}
}
if( attributeName.ToLower() == "name")
{
paramName = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
}
if( attributeName.ToLower() == "value")
{
paramValue = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
// delete trailing /
while((paramValue.Length>0)&&(paramValue[paramValue.Length-1] == '/'))
paramValue = paramValue.Substring(0,paramValue.Length-1);
}
nAttrIdx = mA.Index+mA.Length;
}
switch(paramName.ToLower())
{
case "savetype": // inclusive information type name
{
prevItem = 1;
sName = paramValue;
};break;
case "savetypedesc": // description of information type
{
InformationTypeMode mode = InformationTypeMode.Inclusive;
sDescription = paramValue;
if( prevItem == 1)
mode = InformationTypeMode.Inclusive;
if( prevItem == 2)
mode = InformationTypeMode.Exclusive;
if( prevItem == 3)
mode = InformationTypeMode.Hidden;
if( chmFile.GetInformationType( sName ) == null)
{
// check if the HtmlHelpSystem already holds such an information type
if( chmFile.SystemInstance.GetInformationType( sName ) == null)
{
// info type not found yet
InformationType newType = new InformationType(sName, sDescription, mode);
chmFile.InformationTypes.Add(newType);
}
else
{
InformationType sysType = chmFile.SystemInstance.GetInformationType( sName );
chmFile.InformationTypes.Add( sysType );
}
}
prevItem = 0;
};break;
case "saveexclusive": // exclusive information type name
{
prevItem = 2;
sName = paramValue;
};break;
case "savehidden": // hidden information type name
{
prevItem = 3;
sName = paramValue;
};break;
case "category": // category name
{
prevItem = 4;
sName = paramValue;
curCategory = sName;
};break;
case "categorydesc": // category description
{
sDescription = paramValue;
if( chmFile.GetCategory( sName ) == null)
{
// check if the HtmlHelpSystem already holds such a category
if( chmFile.SystemInstance.GetCategory( sName ) == null)
{
// add category
Category newCat = new Category(sName, sDescription);
chmFile.Categories.Add(newCat);
}
else
{
Category sysCat = chmFile.SystemInstance.GetCategory( sName );
chmFile.Categories.Add( sysCat );
}
}
prevItem = 0;
};break;
case "type": // inclusive information type which is member of the previously read category
{
prevItem = 5;
sName = paramValue;
};break;
case "typedesc": // description of type for category
{
sDescription = paramValue;
Category cat = chmFile.GetCategory( curCategory );
if( cat != null)
{
// category found
InformationType infoType = chmFile.GetInformationType( sName );
if( infoType != null)
{
if( !cat.ContainsInformationType(infoType))
{
infoType.SetCategoryFlag(true);
cat.AddInformationType(infoType);
}
}
}
prevItem = 0;
};break;
case "typeexclusive": // exclusive information type which is member of the previously read category
{
prevItem = 6;
sName = paramValue;
};break;
case "typehidden": // hidden information type which is member of the previously read category
{
prevItem = 7;
sName = paramValue;
};break;
default:
{
prevItem = 0;
sName = "";
sDescription = "";
};break;
}
nParamIndex = mP.Index+mP.Length;
}
}
}
}

View File

@@ -1,220 +0,0 @@
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>HHCParser</c> implements a parser for HHC contents files.
/// </summary>
// internal sealed class HHCParser : IHHCParser
public class HHCParser2
{
static private string m_text1="";
static private string m_text2="";
static private int m_CurrentPos=0;
/// <summary>
/// Parses a HHC file and returns an ArrayList with the table of contents (TOC) tree
/// </summary>
/// <param name="hhcFile">string content of the hhc file</param>
/// <param name="chmFile">CHMFile instance</param>
/// <returns>Returns an ArrayList with the table of contents (TOC) tree</returns>
public static ArrayList ParseHHC(string hhcFile, CHMFile chmFile)
{
DateTime StartTime=DateTime.Now;
ArrayList tocList = new ArrayList();
m_text2=hhcFile;
m_text1=hhcFile.ToLower();
int idx=m_text1.IndexOf("<ul>");
if (idx==-1)
return null;
m_CurrentPos=idx+4;
ParamRE = new Regex(RE_ParamBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
AttributesRE = new Regex(RE_QuoteAttributes, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ParseTree(tocList,chmFile);
DateTime EndTime=DateTime.Now;
TimeSpan Diff=EndTime-StartTime;
string x=Diff.ToString();
return tocList;
}
/// <summary>
/// Recursively parses a sitemap tree
/// </summary>
/// <param name="text">content text</param>
/// <param name="arrNodes">arraylist which receives the extracted nodes</param>
/// <param name="chmFile">CHMFile instance</param>
static private void ParseTree( ArrayList arrNodes, CHMFile chmFile )
{
bool bProcessing=true;
do
{
bProcessing=false;
// Indent
int idxa=m_text1.IndexOf("<ul>",m_CurrentPos);
int idxb=m_text1.IndexOf("<li>",m_CurrentPos);
int idxc=m_text1.IndexOf("</ul>",m_CurrentPos);
if ((idxa<idxb) && (idxa<idxc) && (idxa>-1))
{
bProcessing=true;
m_CurrentPos=idxa+4;
if (arrNodes.Count<1)
{
ParseTree(arrNodes,chmFile);
}
else
{
ParseTree(((TOCItem)(arrNodes[arrNodes.Count-1])).Children,chmFile);
}
continue;
}
// new item
if ((idxb<idxa) && (idxb<idxc) && (idxb>-1))
{
bProcessing=true;
m_CurrentPos=idxb+4;
int idx2=m_text1.IndexOf("<object",m_CurrentPos);
if (idx2!=-1)
{
int idx3=m_text1.IndexOf("</object>",idx2+7);
if (idx3!=-1)
{
string text=m_text2.Substring(idx2,idx3-idx2);
m_CurrentPos=idx3+9;
// Parse items in text.
TOCItem tocItem=ParseItems(text, chmFile);
if (tocItem!=null)
{
arrNodes.Add(tocItem);
}
}
}
}
// Undent
if ((idxc<idxa) && (idxc<idxb) && (idxc>-1))
{
m_CurrentPos=idxc+5;
bProcessing=true;
return;
}
}
while (bProcessing);
}
private static string RE_ParamBoundaries = @"\<param(?<innerText>.*?)\>";
private const string RE_QuoteAttributes = @"( |\t)*(?<attributeName>[\-a-zA-Z0-9]*)( |\t)*=( |\t)*(?<attributeTD>[\""\'])?(?<attributeValue>.*?(?(attributeTD)\k<attributeTD>|([\s>]|.$)))";
private static Regex ParamRE;
private static Regex AttributesRE;
/// <summary>
/// Parses tree nodes from the text
/// </summary>
/// <param name="itemstext">text containing the items</param>
/// <param name="arrNodes">arraylist where the nodes should be added</param>
/// <param name="chmFile">CHMFile instance</param>
private static TOCItem ParseItems( string itemstext, CHMFile chmFile)
{
int innerPTextIdx = ParamRE.GroupNumberFromName("innerText");
// get group-name indexes
int nameIndex = AttributesRE.GroupNumberFromName("attributeName");
int valueIndex = AttributesRE.GroupNumberFromName("attributeValue");
int tdIndex = AttributesRE.GroupNumberFromName("attributeTD");
TOCItem tocItem = new TOCItem();
// read parameters
int nParamIndex = 0;
while( ParamRE.IsMatch(itemstext, nParamIndex) )
{
Match mP = ParamRE.Match(itemstext, nParamIndex);
string innerP = mP.Groups[innerPTextIdx].Value;
string paramName = "";
string paramValue = "";
int nAttrIdx = 0;
while( AttributesRE.IsMatch( innerP, nAttrIdx ) )
{
Match mA = AttributesRE.Match(innerP, nAttrIdx);
string attributeName = mA.Groups[nameIndex].Value;
string attributeValue = mA.Groups[valueIndex].Value;
string attributeTD = mA.Groups[tdIndex].Value;
if(attributeTD.Length > 0)
{
// delete the trailing textqualifier
if( attributeValue.Length > 0)
{
int ltqi = attributeValue.LastIndexOf( attributeTD );
if(ltqi >= 0)
{
attributeValue = attributeValue.Substring(0,ltqi);
}
}
}
if( attributeName.ToLower() == "name")
{
paramName = attributeValue;
}
if( attributeName.ToLower() == "value")
{
paramValue = attributeValue;
}
nAttrIdx = mA.Index+mA.Length;
}
tocItem.Params[paramName] = paramValue;
switch(paramName.ToLower())
{
case "name":
{
tocItem.Name = paramValue;
};break;
case "local":
{
tocItem.Local = paramValue;
};break;
case "imagenumber":
{
tocItem.ImageIndex = Int32.Parse(paramValue);
if( tocItem.ImageIndex == 2)
tocItem.ImageIndex = TOCItem.STD_FOLDER_HH1;
};break;
}
nParamIndex = mP.Index+mP.Length;
}
tocItem.ChmFile = chmFile.ChmFilePath;
return tocItem;
}
}
}

View File

@@ -1,550 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>HHKParser</c> implements a parser for HHK contents files.
/// </summary>
internal sealed class HHKParser
{
/// <summary>
/// regular expressions for replacing the sitemap boundary tags
/// </summary>
private static string RE_ULOpening = @"\<ul\>"; // will be replaced by a '(' for nested parsing
private static string RE_ULClosing = @"\</ul\>"; // will be replaced by a ')' for nested parsing
/// <summary>
/// Matching ul-tags
/// </summary>
private static string RE_ULBoundaries = @"\<ul\>(?<innerText>.*)\</ul\>";
/// <summary>
/// Matching the nested tree structure.
/// </summary>
private static string RE_NestedBoundaries = @"\( (?> [^()]+ | \( (?<DEPTH>) | \) (?<-DEPTH>) )* (?(DEPTH)(?!)) \)";
/// <summary>
/// Matching object-tags
/// </summary>
private static string RE_ObjectBoundaries = @"\<object(?<innerText>.*?)\</object\>";
/// <summary>
/// Matching param tags
/// </summary>
private static string RE_ParamBoundaries = @"\<param(?<innerText>.*?)\>";
/// <summary>
/// Extracting tag attributes
/// </summary>
private const string RE_QuoteAttributes = @"( |\t)*(?<attributeName>[\-a-zA-Z0-9]*)( |\t)*=( |\t)*(?<attributeTD>[\""\'])?(?<attributeValue>.*?(?(attributeTD)\k<attributeTD>|([\s>]|.$)))";
/// <summary>
/// private regular expressionobjects
/// </summary>
private static Regex ulRE;
private static Regex NestedRE;
private static Regex ObjectRE;
private static Regex ParamRE;
private static Regex AttributesRE;
/// <summary>
/// Parses a HHK file and returns an ArrayList with the index tree
/// </summary>
/// <param name="hhkFile">string content of the hhk file</param>
/// <param name="chmFile">CHMFile instance</param>
/// <returns>Returns an ArrayList with the index tree</returns>
public static ArrayList ParseHHK(string hhkFile, CHMFile chmFile)
{
ArrayList indexList = new ArrayList();
ulRE = new Regex(RE_ULBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
NestedRE = new Regex(RE_NestedBoundaries, RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ObjectRE = new Regex(RE_ObjectBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
ParamRE = new Regex(RE_ParamBoundaries, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
AttributesRE = new Regex(RE_QuoteAttributes, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
int innerTextIdx = ulRE.GroupNumberFromName("innerText");
if( ulRE.IsMatch(hhkFile, 0) )
{
Match m = ulRE.Match(hhkFile, 0);
if( ObjectRE.IsMatch(hhkFile, 0) ) // first object block contains information types and categories
{
Match mO = ObjectRE.Match(hhkFile, 0);
int iOTxt = ObjectRE.GroupNumberFromName("innerText");
string globalText = mO.Groups[iOTxt].Value;
ParseGlobalSettings( globalText, chmFile );
}
string innerText = m.Groups["innerText"].Value;
innerText = innerText.Replace("(", "&#040;");
innerText = innerText.Replace(")", "&#041;");
innerText = Regex.Replace(innerText, RE_ULOpening, "(", RegexOptions.IgnoreCase);
innerText = Regex.Replace(innerText, RE_ULClosing, ")", RegexOptions.IgnoreCase);
ParseTree( innerText, null, indexList, chmFile );
}
return indexList;
}
/// <summary>
/// Recursively parses a sitemap tree
/// </summary>
/// <param name="text">content text</param>
/// <param name="parent">Parent for all read items</param>
/// <param name="arrNodes">arraylist which receives the extracted nodes</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseTree( string text, IndexItem parent, ArrayList arrNodes, CHMFile chmFile )
{
string strPreItems="", strPostItems="";
string innerText = "";
int nIndex = 0;
while( NestedRE.IsMatch(text, nIndex) )
{
Match m = NestedRE.Match(text, nIndex);
innerText = m.Value.Substring( 1, m.Length-2);
strPreItems = text.Substring(nIndex,m.Index-nIndex);
ParseItems(strPreItems, parent, arrNodes, chmFile);
if((arrNodes.Count>0) && (innerText.Length > 0) )
{
IndexItem p = ((IndexItem)(arrNodes[arrNodes.Count-1]));
ParseTree( innerText, p, arrNodes, chmFile );
}
nIndex = m.Index+m.Length;
}
if( nIndex == 0)
{
strPostItems = text.Substring(nIndex, text.Length-nIndex);
ParseItems(strPostItems, parent, arrNodes, chmFile);
}
else if( nIndex < text.Length-1)
{
strPostItems = text.Substring(nIndex, text.Length-nIndex);
ParseTree(strPostItems, parent, arrNodes, chmFile);
}
}
/// <summary>
/// Parses nodes from the text
/// </summary>
/// <param name="itemstext">text containing the items</param>
/// <param name="parentItem">parent index item</param>
/// <param name="arrNodes">arraylist where the nodes should be added</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseItems( string itemstext, IndexItem parentItem, ArrayList arrNodes, CHMFile chmFile)
{
int innerTextIdx = ObjectRE.GroupNumberFromName("innerText");
int innerPTextIdx = ParamRE.GroupNumberFromName("innerText");
// get group-name indexes
int nameIndex = AttributesRE.GroupNumberFromName("attributeName");
int valueIndex = AttributesRE.GroupNumberFromName("attributeValue");
int tdIndex = AttributesRE.GroupNumberFromName("attributeTD");
int nObjStartIndex = 0;
int nLastObjStartIndex = 0;
string sKeyword = "";
while( ObjectRE.IsMatch(itemstext, nObjStartIndex) )
{
Match m = ObjectRE.Match(itemstext, nObjStartIndex);
string innerText = m.Groups[innerTextIdx].Value;
IndexItem idxItem = new IndexItem();
// read parameters
int nParamIndex = 0;
int nNameCnt = 0;
string paramTitle = "";
string paramLocal = "";
bool bAdded = false;
while( ParamRE.IsMatch(innerText, nParamIndex) )
{
Match mP = ParamRE.Match(innerText, nParamIndex);
string innerP = mP.Groups[innerPTextIdx].Value;
string paramName = "";
string paramValue = "";
int nAttrIdx = 0;
//sKeyword = "";
while( AttributesRE.IsMatch( innerP, nAttrIdx ) )
{
Match mA = AttributesRE.Match(innerP, nAttrIdx);
string attributeName = mA.Groups[nameIndex].Value;
string attributeValue = mA.Groups[valueIndex].Value;
string attributeTD = mA.Groups[tdIndex].Value;
if(attributeTD.Length > 0)
{
// delete the trailing textqualifier
if( attributeValue.Length > 0)
{
int ltqi = attributeValue.LastIndexOf( attributeTD );
if(ltqi >= 0)
{
attributeValue = attributeValue.Substring(0,ltqi);
}
}
}
if( attributeName.ToLower() == "name")
{
paramName = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
nNameCnt++;
}
if( attributeName.ToLower() == "value")
{
paramValue = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
// delete trailing /
while((paramValue.Length>0)&&(paramValue[paramValue.Length-1] == '/'))
paramValue = paramValue.Substring(0,paramValue.Length-1);
}
nAttrIdx = mA.Index+mA.Length;
}
if( nNameCnt == 1) // first "Name" param = keyword
{
sKeyword = "";
if(parentItem != null)
sKeyword = parentItem.KeyWordPath + ",";
string sOldKW = sKeyword;
sKeyword += paramValue;
IndexItem idxFind = FindByKeyword(arrNodes, sKeyword);
if(idxFind != null)
{
idxItem = idxFind;
}
else
{
if( sKeyword.Split(new char[] {','}).Length > 1 )
{
idxItem.CharIndex = sKeyword.Length - paramValue.Length;
}
else
{
sKeyword = paramValue;
sOldKW = sKeyword;
idxItem.CharIndex = 0;
}
idxItem.KeyWordPath = sKeyword;
idxItem.Indent = sKeyword.Split(new char[] {','}).Length - 1;
idxItem.IsSeeAlso = false;
sKeyword = sOldKW;
}
}
else
{
if( (nNameCnt > 2) && (paramName.ToLower()=="name") )
{
bAdded = true;
IndexTopic idxTopic = new IndexTopic(paramTitle, paramLocal, chmFile.CompileFile, chmFile.ChmFilePath);
idxItem.Topics.Add( idxTopic );
paramTitle = "";
paramLocal = "";
}
switch(paramName.ToLower())
{
case "name":
//case "keyword":
{
paramTitle = paramValue;
};break;
case "local":
{
paramLocal = paramValue.Replace("../", "").Replace("./", "");
};break;
case "type": // information type assignment for item
{
idxItem.InfoTypeStrings.Add( paramValue );
};break;
case "see also":
{
idxItem.AddSeeAlso(paramValue);
idxItem.IsSeeAlso = true;
bAdded = true;
};break;
}
}
nParamIndex = mP.Index+mP.Length;
}
if(!bAdded)
{
bAdded=false;
IndexTopic idxTopic = new IndexTopic(paramTitle, paramLocal, chmFile.CompileFile, chmFile.ChmFilePath);
idxItem.Topics.Add( idxTopic );
paramTitle = "";
paramLocal = "";
}
idxItem.ChmFile = chmFile;
arrNodes.Add( idxItem );
nLastObjStartIndex = nObjStartIndex;
nObjStartIndex = m.Index+m.Length;
}
}
/// <summary>
/// Searches an index-keyword in the index list
/// </summary>
/// <param name="indexList">index list to search</param>
/// <param name="Keyword">keyword to find</param>
/// <returns>Returns an <see cref="IndexItem">IndexItem</see> instance if found, otherwise null.</returns>
private static IndexItem FindByKeyword(ArrayList indexList, string Keyword)
{
foreach(IndexItem curItem in indexList)
{
if( curItem.KeyWordPath == Keyword)
return curItem;
}
return null;
}
/// <summary>
/// Parses the very first &lt;OBJECT&gt; tag in the sitemap file and extracts
/// information types and categories.
/// </summary>
/// <param name="sText">text of the object tag</param>
/// <param name="chmFile">CHMFile instance</param>
private static void ParseGlobalSettings(string sText, CHMFile chmFile)
{
int innerPTextIdx = ParamRE.GroupNumberFromName("innerText");
// get group-name indexes
int nameIndex = AttributesRE.GroupNumberFromName("attributeName");
int valueIndex = AttributesRE.GroupNumberFromName("attributeValue");
int tdIndex = AttributesRE.GroupNumberFromName("attributeTD");
// read parameters
int nParamIndex = 0;
// 0... unknown
// 1... inclusinve info type name
// 2... exclusive info type name
// 3... hidden info type name
// 4... category name
// 5... incl infotype name for category
// 6... excl infotype name for category
// 7... hidden infotype name for category
int prevItem = 0;
string sName = "";
string sDescription = "";
string curCategory = "";
while( ParamRE.IsMatch(sText, nParamIndex) )
{
Match mP = ParamRE.Match(sText, nParamIndex);
string innerP = mP.Groups[innerPTextIdx].Value;
string paramName = "";
string paramValue = "";
int nAttrIdx = 0;
while( AttributesRE.IsMatch( innerP, nAttrIdx ) )
{
Match mA = AttributesRE.Match(innerP, nAttrIdx);
string attributeName = mA.Groups[nameIndex].Value;
string attributeValue = mA.Groups[valueIndex].Value;
string attributeTD = mA.Groups[tdIndex].Value;
if(attributeTD.Length > 0)
{
// delete the trailing textqualifier
if( attributeValue.Length > 0)
{
int ltqi = attributeValue.LastIndexOf( attributeTD );
if(ltqi >= 0)
{
attributeValue = attributeValue.Substring(0,ltqi);
}
}
}
if( attributeName.ToLower() == "name")
{
paramName = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
}
if( attributeName.ToLower() == "value")
{
paramValue = HttpUtility.HtmlDecode(attributeValue); // for unicode encoded values
// delete trailing /
while((paramValue.Length>0)&&(paramValue[paramValue.Length-1] == '/'))
paramValue = paramValue.Substring(0,paramValue.Length-1);
}
nAttrIdx = mA.Index+mA.Length;
}
switch(paramName.ToLower())
{
case "savetype": // inclusive information type name
{
prevItem = 1;
sName = paramValue;
};break;
case "savetypedesc": // description of information type
{
InformationTypeMode mode = InformationTypeMode.Inclusive;
sDescription = paramValue;
if( prevItem == 1)
mode = InformationTypeMode.Inclusive;
if( prevItem == 2)
mode = InformationTypeMode.Exclusive;
if( prevItem == 3)
mode = InformationTypeMode.Hidden;
if( chmFile.GetInformationType( sName ) == null)
{
// check if the HtmlHelpSystem already holds such an information type
if( chmFile.SystemInstance.GetInformationType( sName ) == null)
{
// info type not found yet
InformationType newType = new InformationType(sName, sDescription, mode);
chmFile.InformationTypes.Add(newType);
}
else
{
InformationType sysType = chmFile.SystemInstance.GetInformationType( sName );
chmFile.InformationTypes.Add( sysType );
}
}
prevItem = 0;
};break;
case "saveexclusive": // exclusive information type name
{
prevItem = 2;
sName = paramValue;
};break;
case "savehidden": // hidden information type name
{
prevItem = 3;
sName = paramValue;
};break;
case "category": // category name
{
prevItem = 4;
sName = paramValue;
curCategory = sName;
};break;
case "categorydesc": // category description
{
sDescription = paramValue;
if( chmFile.GetCategory( sName ) == null)
{
// check if the HtmlHelpSystem already holds such a category
if( chmFile.SystemInstance.GetCategory( sName ) == null)
{
// add category
Category newCat = new Category(sName, sDescription);
chmFile.Categories.Add(newCat);
}
else
{
Category sysCat = chmFile.SystemInstance.GetCategory( sName );
chmFile.Categories.Add( sysCat );
}
}
prevItem = 0;
};break;
case "type": // inclusive information type which is member of the previously read category
{
prevItem = 5;
sName = paramValue;
};break;
case "typedesc": // description of type for category
{
sDescription = paramValue;
Category cat = chmFile.GetCategory( curCategory );
if( cat != null)
{
// category found
InformationType infoType = chmFile.GetInformationType( sName );
if( infoType != null)
{
if( !cat.ContainsInformationType(infoType))
{
infoType.SetCategoryFlag(true);
cat.AddInformationType(infoType);
}
}
}
prevItem = 0;
};break;
case "typeexclusive": // exclusive information type which is member of the previously read category
{
prevItem = 6;
sName = paramValue;
};break;
case "typehidden": // hidden information type which is member of the previously read category
{
prevItem = 7;
sName = paramValue;
};break;
default:
{
prevItem = 0;
sName = "";
sDescription = "";
};break;
}
nParamIndex = mP.Index+mP.Length;
}
}
}
}

View File

@@ -1,245 +0,0 @@
using System;
using System.IO;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>TopicEntry</c> stores the data for one topic entry
/// </summary>
internal sealed class TopicEntry
{
/// <summary>
/// Internal member storing the offset of this topic entry
/// </summary>
private int _entryOffset = 0;
/// <summary>
/// Internal member storing the index of the binary toc
/// </summary>
private int _tocidxOffset = 0;
/// <summary>
/// Internal member storing the string offset of the title
/// </summary>
private int _titleOffset = 0;
/// <summary>
/// Internal member storuing the urltable offset
/// </summary>
private int _urltableOffset = 0;
/// <summary>
/// Internal member storing the visibility mode
/// </summary>
private int _visibilityMode = 0;
/// <summary>
/// Internal member storing an unknown mode
/// </summary>
private int _unknownMode = 0;
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="entryOffset">offset of this entry</param>
/// <param name="tocidxOffset">offset in the binary toc index</param>
/// <param name="titleOffset">offset of the title (in the #STRINGS file)</param>
/// <param name="urltableOffset">offset in the urltable containing the urlstr offset for the url</param>
/// <param name="visibilityMode">visibility mode 2 indicates not in contents, 6 indicates that it is in the contents, 0/4 something else (unknown)</param>
/// <param name="unknownMode">0, 2, 4, 8, 10, 12, 16, 32 (unknown)</param>
public TopicEntry(int entryOffset, int tocidxOffset, int titleOffset, int urltableOffset, int visibilityMode, int unknownMode) :this(entryOffset, tocidxOffset, titleOffset, urltableOffset, visibilityMode, unknownMode, null)
{
}
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="entryOffset">offset of this entry</param>
/// <param name="tocidxOffset">offset in the binary toc index</param>
/// <param name="titleOffset">offset of the title (in the #STRINGS file)</param>
/// <param name="urltableOffset">offset in the urltable containing the urlstr offset for the url</param>
/// <param name="visibilityMode">visibility mode 2 indicates not in contents, 6 indicates that it is in the contents, 0/4 something else (unknown)</param>
/// <param name="unknownMode">0, 2, 4, 8, 10, 12, 16, 32 (unknown)</param>
/// <param name="associatedFile">associated chmfile object</param>
internal TopicEntry(int entryOffset, int tocidxOffset, int titleOffset, int urltableOffset, int visibilityMode, int unknownMode, CHMFile associatedFile)
{
_entryOffset = entryOffset;
_tocidxOffset = tocidxOffset;
_titleOffset = titleOffset;
_urltableOffset = urltableOffset;
_visibilityMode = visibilityMode;
_unknownMode = unknownMode;
_associatedFile = associatedFile;
}
/// <summary>
/// Standard constructor
/// </summary>
internal TopicEntry()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _entryOffset );
writer.Write( _tocidxOffset );
writer.Write( _titleOffset );
writer.Write( _urltableOffset );
writer.Write( _visibilityMode );
writer.Write( _unknownMode );
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
_entryOffset = reader.ReadInt32();
_tocidxOffset = reader.ReadInt32();
_titleOffset = reader.ReadInt32();
_urltableOffset = reader.ReadInt32();
_visibilityMode = reader.ReadInt32();
_unknownMode = reader.ReadInt32();
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
}
#endregion
/// <summary>
/// Gets the associated chm file
/// </summary>
internal CHMFile ChmFile
{
get { return _associatedFile; }
}
/// <summary>
/// Gets the offset of this entry
/// </summary>
internal int EntryOffset
{
get { return _entryOffset; }
}
/// <summary>
/// Gets the tocidx offset
/// </summary>
internal int TOCIdxOffset
{
get { return _tocidxOffset; }
}
/// <summary>
/// Gets the title offset of the #STRINGS file
/// </summary>
internal int TitleOffset
{
get { return _titleOffset; }
}
/// <summary>
/// Gets the urltable offset
/// </summary>
internal int UrlTableOffset
{
get { return _urltableOffset; }
}
/// <summary>
/// Gets the title of the topic entry
/// </summary>
public string Title
{
get
{
if( _associatedFile == null)
return String.Empty;
if( _associatedFile.StringsFile == null)
return String.Empty;
string sTemp = (string)_associatedFile.StringsFile[ _titleOffset ];
if(sTemp == null)
return String.Empty;
return sTemp;
}
}
/// <summary>
/// Gets the url of the topic
/// </summary>
public string Locale
{
get
{
if( _associatedFile == null)
return String.Empty;
if( _associatedFile.UrltblFile == null)
return String.Empty;
UrlTableEntry utEntry = (UrlTableEntry)_associatedFile.UrltblFile[ _urltableOffset ];
if(utEntry == null)
return String.Empty;
if(utEntry.URL == "")
return String.Empty;
return utEntry.URL;
}
}
/// <summary>
/// Gets the URL of this topic
/// </summary>
public string URL
{
get
{
if(Locale.Length <= 0)
return "about:blank";
if( (Locale.ToLower().IndexOf("http://") >= 0) ||
(Locale.ToLower().IndexOf("https://") >= 0) ||
(Locale.ToLower().IndexOf("mailto:") >= 0) ||
(Locale.ToLower().IndexOf("ftp://") >= 0) ||
(Locale.ToLower().IndexOf("ms-its:") >= 0))
return Locale;
return HtmlHelpSystem.UrlPrefix + _associatedFile.ChmFilePath + "::/" + Locale;
}
}
/// <summary>
/// Gets the visibility mode
/// </summary>
public int VisibilityMode
{
get { return _visibilityMode; }
}
/// <summary>
/// Gets the unknown mode
/// </summary>
public int UknownMode
{
get { return _unknownMode; }
}
}
}

View File

@@ -1,175 +0,0 @@
using System;
using System.IO;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// The class <c>UrlTableEntry</c> stores data for an URL-Table entry
/// </summary>
internal sealed class UrlTableEntry
{
/// <summary>
/// Internal member storing the offset of this entry
/// </summary>
private int _entryOffset = 0;
/// <summary>
/// Internal member storing a unique id
/// </summary>
private uint _uniqueID = 0;
/// <summary>
/// Internal member storing the topics index
/// </summary>
private int _topicsIndex = 0;
/// <summary>
/// Internal member storing the offset in the urlstr table
/// </summary>
private int _urlStrOffset = 0;
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="uniqueID">unique id</param>
/// <param name="entryOffset">offset of the entry</param>
/// <param name="topicIndex">topic index</param>
/// <param name="urlstrOffset">urlstr offset for filename</param>
public UrlTableEntry(uint uniqueID, int entryOffset, int topicIndex, int urlstrOffset) : this(uniqueID, entryOffset, topicIndex, urlstrOffset, null)
{
}
/// <summary>
/// Constructor of the class
/// </summary>
/// <param name="uniqueID">unique id</param>
/// <param name="entryOffset">offset of the entry</param>
/// <param name="topicIndex">topic index</param>
/// <param name="urlstrOffset">urlstr offset for filename</param>
/// <param name="associatedFile">associated chm file</param>
internal UrlTableEntry(uint uniqueID, int entryOffset, int topicIndex, int urlstrOffset, CHMFile associatedFile)
{
_uniqueID = uniqueID;
_entryOffset = entryOffset;
_topicsIndex = topicIndex;
_urlStrOffset = urlstrOffset;
_associatedFile = associatedFile;
}
/// <summary>
/// Standard constructor
/// </summary>
internal UrlTableEntry()
{
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _urlStrOffset );
writer.Write( _entryOffset );
writer.Write( _topicsIndex );
writer.Write( _urlStrOffset );
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
internal void ReadDump(ref BinaryReader reader)
{
_urlStrOffset = reader.ReadInt32();
_entryOffset = reader.ReadInt32();
_topicsIndex = reader.ReadInt32();
_urlStrOffset = reader.ReadInt32();
}
/// <summary>
/// Sets the associated CHMFile instance
/// </summary>
/// <param name="associatedFile">instance to set</param>
internal void SetCHMFile(CHMFile associatedFile)
{
_associatedFile = associatedFile;
}
#endregion
/// <summary>
/// Gets the unique id of the entry
/// </summary>
internal uint UniqueID
{
get {return _uniqueID; }
}
/// <summary>
/// Gets the offset of the entry
/// </summary>
internal int EntryOffset
{
get {return _entryOffset; }
}
/// <summary>
/// Gets the topics index
/// </summary>
internal int TopicIndex
{
get {return _topicsIndex; }
}
/// <summary>
/// Gets the urlstr offset
/// </summary>
internal int UrlstrOffset
{
get { return _urlStrOffset; }
}
/// <summary>
/// Gets the url of the entry
/// </summary>
public string URL
{
get
{
if(_associatedFile == null)
return String.Empty;
if(_associatedFile.UrlstrFile == null)
return String.Empty;
string sTemp = (string)_associatedFile.UrlstrFile.GetURLatOffset( _urlStrOffset );
if( sTemp == null)
return String.Empty;
return sTemp;
}
}
/// <summary>
/// Gets the associated topic for this url entry
/// </summary>
internal TopicEntry Topic
{
get
{
if(_associatedFile == null)
return null;
if(_associatedFile.TopicsFile == null)
return null;
TopicEntry tentry = _associatedFile.TopicsFile[ _topicsIndex*16 ];
return tentry;
}
}
}
}

View File

@@ -1,19 +0,0 @@
using System;
namespace HtmlHelp.ChmDecoding
{
/// <summary>
/// Enumeration for specifying the extraction mode of an toc or index item.
/// </summary>
public enum DataMode
{
/// <summary>
/// TextBased - this item comes from a text-based sitemap file
/// </summary>
TextBased = 0,
/// <summary>
/// Binary - this item was extracted out of a binary stream
/// </summary>
Binary = 1
}
}

View File

@@ -1,16 +0,0 @@
<Combine fileversion="1.0" name="CHMLibrary" description="">
<StartMode startupentry="CHMLibrary" single="True">
<Execute entry="CHMLibrary" type="None" />
</StartMode>
<Entries>
<Entry filename=".\.\CHMLibrary.prjx" />
</Entries>
<Configurations active="Debug">
<Configuration name="Release">
<Entry name="CHMLibrary" configurationname="Debug" build="False" />
</Configuration>
<Configuration name="Debug">
<Entry name="CHMLibrary" configurationname="Debug" build="False" />
</Configuration>
</Configurations>
</Combine>

View File

@@ -1,85 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{72E5CCA1-6318-4D62-964D-CB23A5C743B5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CHMLibrary</RootNamespace>
<AssemblyName>CHMLibrary</AssemblyName>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Category.cs" />
<Compile Include="CHMDecoding\BinaryReaderHelp.cs" />
<Compile Include="CHMDecoding\CHMBtree.cs" />
<Compile Include="CHMDecoding\CHMFile.cs" />
<Compile Include="CHMDecoding\CHMIdxhdr.cs" />
<Compile Include="CHMDecoding\CHMStrings.cs" />
<Compile Include="CHMDecoding\CHMSystem.cs" />
<Compile Include="CHMDecoding\CHMTocidx.cs" />
<Compile Include="CHMDecoding\CHMTopics.cs" />
<Compile Include="CHMDecoding\CHMUrlstr.cs" />
<Compile Include="CHMDecoding\CHMUrltable.cs" />
<Compile Include="CHMDecoding\DumpingInfo.cs" />
<Compile Include="CHMDecoding\enumerations.cs" />
<Compile Include="CHMDecoding\FullTextEngine.cs" />
<Compile Include="CHMDecoding\HHCParser.cs" />
<Compile Include="CHMDecoding\HHCParser2.cs" />
<Compile Include="CHMDecoding\HHKParser.cs" />
<Compile Include="CHMDecoding\TopicEntry.cs" />
<Compile Include="CHMDecoding\UrlTableEntry.cs" />
<Compile Include="ChmFileInfo.cs" />
<Compile Include="HtmlHelpSystem.cs" />
<Compile Include="HttpUtility.cs" />
<Compile Include="Index.cs" />
<Compile Include="IndexItem.cs" />
<Compile Include="IndexTopic.cs" />
<Compile Include="InformationType.cs" />
<Compile Include="Storage\CHMStream.cs" />
<Compile Include="TableOfContents.cs" />
<Compile Include="TOCItem.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Compression\Compression.csproj">
<Project>{E32307F1-623A-4E62-826F-56CDD4B23A54}</Project>
<Name>Compression</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@@ -1,58 +0,0 @@
<Project name="CHMLibrary" standardNamespace="CHMLibrary" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
<Contents>
<File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\Category.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\ChmFileInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\Default.build" subtype="Code" buildaction="Nothing" dependson="" data="" />
<File name=".\HtmlHelpSystem.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\HttpUtility.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\Index.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\IndexItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\IndexTopic.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\InformationType.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\TableOfContents.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\TOCItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\Storage" subtype="Directory" buildaction="Compile" dependson="" data="" />
<File name=".\Storage\CHMStream.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding" subtype="Directory" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\BinaryReaderHelp.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMBtree.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMFile.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMIdxhdr.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMStrings.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMSystem.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMTocidx.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMTopics.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMUrlstr.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\CHMUrltable.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\DumpingInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\enumerations.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\FullTextEngine.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\HHCParser2.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\HHCParser.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\HHKParser.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\TopicEntry.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\CHMDecoding\UrlTableEntry.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
</Contents>
<References>
<Reference type="Project" refto="Compression" localcopy="True" />
</References>
<DeploymentInformation target="" script="" strategy="File" />
<Configuration runwithwarnings="True" name="Debug">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Debug" assembly="CHMLibrary" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
<Configurations active="Debug">
<Configuration runwithwarnings="True" name="Debug">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Debug" assembly="CHMLibrary" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
<Configuration runwithwarnings="True" name="Release">
<CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
<Execution commandlineparameters="" consolepause="False" />
<Output directory="..\bin\Release" assembly="CHMLibrary" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
</Configuration>
</Configurations>
</Project>

View File

@@ -1,201 +0,0 @@
using System;
using System.Collections;
using System.IO;
using HtmlHelp.ChmDecoding;
namespace HtmlHelp
{
/// <summary>
/// The class <c>Category</c> implements methods/properties for handling an information category
/// </summary>
/// <remarks>Note: Information types and categories allow users to filter help contents.
/// They are only supported if using sitemap TOC and/or sitemap Index.</remarks>
public class Category
{
private string _name = "";
private string _description = "";
private ArrayList _infoTypes = null;
private int _referenceCount = 1;
/// <summary>
/// Standard constructor
/// </summary>
public Category() : this("","")
{
}
/// <summary>
/// Standard constructor
/// </summary>
/// <param name="name">name of the category</param>
/// <param name="description">description</param>
public Category(string name, string description) : this(name, description, new ArrayList())
{
}
/// <summary>
/// Standard constructor
/// </summary>
/// <param name="name">name of the category</param>
/// <param name="description">description</param>
/// <param name="linkedInformationTypes">Arraylist of InformationType instances which applies to this category</param>
public Category(string name, string description, ArrayList linkedInformationTypes)
{
_name = name;
_description = description;
_infoTypes = linkedInformationTypes;
}
#region Data dumping
/// <summary>
/// Dump the class data to a binary writer
/// </summary>
/// <param name="writer">writer to write the data</param>
internal void Dump(ref BinaryWriter writer)
{
writer.Write( _name );
writer.Write( _description );
writer.Write( _infoTypes.Count );
for(int i=0; i<_infoTypes.Count;i++)
{
InformationType curType = _infoTypes[i] as InformationType;
writer.Write( curType.Name );
}
}
/// <summary>
/// Reads the object data from a dump store
/// </summary>
/// <param name="reader">reader to read the data</param>
/// <param name="chmFile">current CHMFile instance which reads from dump</param>
internal void ReadDump(ref BinaryReader reader, CHMFile chmFile)
{
_name = reader.ReadString();
_description = reader.ReadString();
int nCnt = reader.ReadInt32();
for(int i=0; i<nCnt; i++)
{
string sITName = reader.ReadString();
InformationType linkedType = chmFile.GetInformationType( sITName );
if(linkedType != null)
{
linkedType.SetCategoryFlag(true);
_infoTypes.Add(linkedType);
}
}
}
#endregion
/// <summary>
/// Merges the lineked information types from cat into this instance
/// </summary>
/// <param name="cat">category instance</param>
internal void MergeInfoTypes(Category cat)
{
if(cat!=null)
{
if(cat.InformationTypes.Count > 0)
{
for(int i=0;i<cat.InformationTypes.Count;i++)
{
InformationType curType = cat.InformationTypes[i] as InformationType;
if(!ContainsInformationType(curType.Name))
{
curType.SetCategoryFlag(true);
_infoTypes.Add(curType);
}
}
}
}
}
/// <summary>
/// Gets/Sets the reference count of this information type instance
/// </summary>
internal int ReferenceCount
{
get { return _referenceCount; }
set { _referenceCount = value; }
}
/// <summary>
/// Gets/Sets the name of the information type
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
/// Gets/Sets the description of the information type
/// </summary>
public string Description
{
get { return _description; }
set { _name = value; }
}
/// <summary>
/// Gets an ArrayList with the linked Information types
/// </summary>
public ArrayList InformationTypes
{
get { return _infoTypes; }
}
/// <summary>
/// Adds a new information type to the category
/// </summary>
/// <param name="type"></param>
public void AddInformationType(InformationType type)
{
_infoTypes.Add(type);
}
/// <summary>
/// Removes an information type from the category
/// </summary>
/// <param name="type"></param>
public void RemoveInformationType(InformationType type)
{
_infoTypes.Remove(type);
}
/// <summary>
/// Checks if the category contains an information type
/// </summary>
/// <param name="type">information type instance to check</param>
/// <returns>Return true if the information type is part of this category</returns>
public bool ContainsInformationType(InformationType type)
{
return _infoTypes.Contains(type);
}
/// <summary>
/// Checks if the category contains an information type
/// </summary>
/// <param name="name">name of the information type</param>
/// <returns>Return true if the information type is part of this category</returns>
public bool ContainsInformationType(string name)
{
for(int i=0;i<_infoTypes.Count;i++)
{
InformationType curType = _infoTypes[i] as InformationType;
if(curType.Name == name)
return true;
}
return false;
}
}
}

View File

@@ -1,478 +0,0 @@
using System;
using System.Collections;
using System.Text;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using System.ComponentModel;
using HtmlHelp.ChmDecoding;
// using HtmlHelp.Storage;
namespace HtmlHelp
{
/// <summary>
/// The class <c>ChmFileInfo</c> only extracts system information from a CHM file.
/// It doesn't build the index and table of contents.
/// </summary>
public class ChmFileInfo
{
/// <summary>
/// Internal member storing the full filename
/// </summary>
private string _chmFileName = "";
/// <summary>
/// Internal member storing the associated chmfile object
/// </summary>
private CHMFile _associatedFile = null;
/// <summary>
/// Constructor for extrating the file information of the provided file.
/// The constructor opens the chm-file and reads its system data.
/// </summary>
/// <param name="chmFile">full file name which information should be extracted</param>
public ChmFileInfo(string chmFile)
{
if(!File.Exists(chmFile))
throw new ArgumentException("Chm file must exist on disk !", "chmFileName");
if( ! chmFile.ToLower().EndsWith(".chm") )
throw new ArgumentException("HtmlHelp file must have the extension .chm !", "chmFile");
_chmFileName = chmFile;
_associatedFile = new CHMFile(null, chmFile, true); // only load system data of chm
}
/// <summary>
/// Internal constructor used in the class <see cref="HtmlHelp.ChmDecoding.CHMFile">CHMFile</see>.
/// </summary>
/// <param name="associatedFile">associated chm file</param>
internal ChmFileInfo(CHMFile associatedFile)
{
_associatedFile = associatedFile;
if( _associatedFile == null)
throw new ArgumentException("Associated CHMFile instance must not be null !", "associatedFile");
}
#region default info properties
/// <summary>
/// Gets the full filename of the chm file
/// </summary>
public string ChmFileName
{
get
{
return _associatedFile.ChmFilePath;
}
}
/// <summary>
/// Gets a <see cref="System.IO.FileInfo">FileInfo</see> instance for the chm file.
/// </summary>
public FileInfo FileInfo
{
get { return new FileInfo(_associatedFile.ChmFilePath); }
}
#endregion
#region #SYSTEM properties
/// <summary>
/// Gets the file version of the chm file.
/// 2 for Compatibility=1.0, 3 for Compatibility=1.1
/// </summary>
public int FileVersion
{
get
{
if(_associatedFile != null)
return _associatedFile.FileVersion;
return 0;
}
}
/// <summary>
/// Gets the contents file name
/// </summary>
public string ContentsFile
{
get
{
if(_associatedFile != null)
return _associatedFile.ContentsFile;
return "";
}
}
/// <summary>
/// Gets the index file name
/// </summary>
public string IndexFile
{
get
{
if(_associatedFile != null)
return _associatedFile.IndexFile;
return "";
}
}
/// <summary>
/// Gets the default help topic
/// </summary>
public string DefaultTopic
{
get
{
if(_associatedFile != null)
return _associatedFile.DefaultTopic;
return "";
}
}
/// <summary>
/// Gets the title of the help window
/// </summary>
public string HelpWindowTitle
{
get
{
if(_associatedFile != null)
return _associatedFile.HelpWindowTitle;
return "";
}
}
/// <summary>
/// Gets the flag if DBCS is in use
/// </summary>
public bool DBCS
{
get
{
if(_associatedFile != null)
return _associatedFile.DBCS;
return false;
}
}
/// <summary>
/// Gets the flag if full-text-search is available
/// </summary>
public bool FullTextSearch
{
get
{
if(_associatedFile != null)
return _associatedFile.FullTextSearch;
return false;
}
}
/// <summary>
/// Gets the flag if the file has ALinks
/// </summary>
public bool HasALinks
{
get
{
if(_associatedFile != null)
return _associatedFile.HasALinks;
return false;
}
}
/// <summary>
/// Gets the flag if the file has KLinks
/// </summary>
public bool HasKLinks
{
get
{
if(_associatedFile != null)
return _associatedFile.HasKLinks;
return false;
}
}
/// <summary>
/// Gets the default window name
/// </summary>
public string DefaultWindow
{
get
{
if(_associatedFile != null)
return _associatedFile.DefaultWindow;
return "";
}
}
/// <summary>
/// Gets the file name of the compile file
/// </summary>
public string CompileFile
{
get
{
if(_associatedFile != null)
return _associatedFile.CompileFile;
return "";
}
}
/// <summary>
/// Gets the flag if the chm has a binary index file
/// </summary>
public bool BinaryIndex
{
get
{
if(_associatedFile != null)
return _associatedFile.BinaryIndex;
return false;
}
}
/// <summary>
/// Gets the flag if the chm has a binary index file
/// </summary>
public string CompilerVersion
{
get
{
if(_associatedFile != null)
return _associatedFile.CompilerVersion;
return "";
}
}
/// <summary>
/// Gets the flag if the chm has a binary toc file
/// </summary>
public bool BinaryTOC
{
get
{
if(_associatedFile != null)
return _associatedFile.BinaryTOC;
return false;
}
}
/// <summary>
/// Gets the font face of the read font property.
/// Empty string for default font.
/// </summary>
public string FontFace
{
get
{
if(_associatedFile != null)
return _associatedFile.FontFace;
return "";
}
}
/// <summary>
/// Gets the font size of the read font property.
/// 0 for default font size
/// </summary>
public double FontSize
{
get
{
if(_associatedFile != null)
return _associatedFile.FontSize;
return 0.0;
}
}
/// <summary>
/// Gets the character set of the read font property
/// 1 for default
/// </summary>
public int CharacterSet
{
get
{
if(_associatedFile != null)
return _associatedFile.CharacterSet;
return 1;
}
}
/// <summary>
/// Gets the codepage depending on the read font property
/// </summary>
public int CodePage
{
get
{
if(_associatedFile != null)
return _associatedFile.CodePage;
return 0;
}
}
/// <summary>
/// Gets the assiciated culture info
/// </summary>
public CultureInfo Culture
{
get
{
if(_associatedFile != null)
return _associatedFile.Culture;
return CultureInfo.CurrentCulture;
}
}
#endregion
#region #IDXHDR properties
/// <summary>
/// Gets the number of topic nodes including the contents and index files
/// </summary>
public int NumberOfTopicNodes
{
get
{
if(_associatedFile != null)
return _associatedFile.NumberOfTopicNodes;
return 0;
}
}
/// <summary>
/// Gets the ImageList string specyfied in the #IDXHDR file.
/// </summary>
/// <remarks>This property uses the #STRINGS file to extract the string at a given offset.</remarks>
public string ImageList
{
get
{
if(_associatedFile != null)
return _associatedFile.ImageList;
return "";
}
}
/// <summary>
/// Gets the background setting
/// </summary>
public int Background
{
get
{
if(_associatedFile != null)
return _associatedFile.Background;
return 0;
}
}
/// <summary>
/// Gets the foreground setting
/// </summary>
public int Foreground
{
get
{
if(_associatedFile != null)
return _associatedFile.Foreground;
return 0;
}
}
/// <summary>
/// Gets the FrameName string specyfied in the #IDXHDR file.
/// </summary>
/// <remarks>This property uses the #STRINGS file to extract the string at a given offset.</remarks>
public string FrameName
{
get
{
if(_associatedFile != null)
return _associatedFile.FrameName;
return "";
}
}
/// <summary>
/// Gets the WindowName string specyfied in the #IDXHDR file.
/// </summary>
/// <remarks>This property uses the #STRINGS file to extract the string at a given offset.</remarks>
public string WindowName
{
get
{
if(_associatedFile != null)
return _associatedFile.WindowName;
return "";
}
}
/// <summary>
/// Gets a string array containing the merged file names
/// </summary>
public string[] MergedFiles
{
get
{
if(_associatedFile != null)
return _associatedFile.MergedFiles;
return new string[0];
}
}
#endregion
}
}

View File

@@ -1,23 +0,0 @@
<?xml version="1.0"?>
<project name="CHMLibrary" default="build">
<property name="output.dir" value="..\bin" />
<target name="build" description="Build component">
<mkdir dir="${output.dir}" />
<csc target="library"
output="${output.dir}\CHMLibrary.dll"
optimize="true"
debug="true"
doc="${output.dir}\CHMLibrary.xml"
warninglevel="0">
<sources>
<include name="**/*.cs" />
</sources>
<references>
<include name="${output.dir}\Compression.dll" />
</references>
</csc>
</target>
</project>

View File

@@ -1,894 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Data;
using HtmlHelp.ChmDecoding;
namespace HtmlHelp
{
/// <summary>
/// The class <c>HtmlHelpSystem</c> implements the main object for reading chm files
/// </summary>
public sealed class HtmlHelpSystem
{
/// <summary>
/// Private shared instance of current HtmlHelpSystem class
/// </summary>
private static HtmlHelpSystem _current=null;
/// <summary>
/// Internal member storing the attached files
/// </summary>
private ArrayList _chmFiles = new ArrayList();
/// <summary>
/// Internal member storing a merged table of contents
/// </summary>
private TableOfContents _toc = new TableOfContents();
/// <summary>
/// Internal member storing a merged index
/// </summary>
private Index _index = new Index();
/// <summary>
/// URL prefix for specifying a chm destination
/// </summary>
private static string _urlPrefix = "ms-its:";
/// <summary>
/// Internal flag specifying if the system should use the tree-images list
/// from HtmlHelp2. If false the standard CHM-Viewer pics will be used.
/// </summary>
private static bool _useHH2TreePics = false;
/// <summary>
/// Internal member storing the read information types
/// </summary>
private ArrayList _informationTypes = new ArrayList();
/// <summary>
/// Internal member storing the read categories
/// </summary>
private ArrayList _categories = new ArrayList();
/// <summary>
/// Gets/Sets the url prefix for specifying a chm destination
/// </summary>
public static string UrlPrefix
{
get { return _urlPrefix; }
set { _urlPrefix = value; }
}
public CHMStream.CHMStream BaseStream
{
get
{
CHMFile chm=(CHMFile)_chmFiles[0];
return chm.BaseStream;
}
}
/// <summary>
/// Gets/Sets the flag specifying if the system should use the tree-images list
/// from HtmlHelp2. If false the standard CHM-Viewer pics will be used.
/// </summary>
public static bool UseHH2TreePics
{
get { return _useHH2TreePics; }
set { _useHH2TreePics = value; }
}
/// <summary>
/// Gets the current HtmlHelpSystem instance
/// </summary>
public static HtmlHelpSystem Current
{
get
{
return _current;
}
}
/// <summary>
/// Standard constructor
/// </summary>
public HtmlHelpSystem() : this("")
{
}
/// <summary>
/// Constructor of the reader class
/// </summary>
/// <param name="chmFile">chm file to attach with the reader</param>
public HtmlHelpSystem(string chmFile)
{
_current = this;
OpenFile(chmFile);
}
/// <summary>
/// Opens a chm file and creates
/// </summary>
/// <param name="chmFile">full file path of the chm file to open</param>
/// <remarks>If you call this method, all existing merged files will be cleared.</remarks>
public void OpenFile(string chmFile)
{
OpenFile(chmFile, null);
}
/// <summary>
/// Opens a chm file and creates
/// </summary>
/// <param name="chmFile">full file path of the chm file to open</param>
/// <param name="dmpInfo">dumping info</param>
/// <remarks>If you call this method, all existing merged files will be cleared.</remarks>
public void OpenFile(string chmFile, DumpingInfo dmpInfo)
{
if( File.Exists(chmFile ) )
{
_chmFiles.Clear();
_toc.Clear();
_index.Clear();
_informationTypes.Clear();
_categories.Clear();
CHMFile newFile = new CHMFile(this, chmFile, dmpInfo);
_toc = new TableOfContents( newFile.TOC );
_index = new Index( newFile.IndexKLinks, newFile.IndexALinks );
_chmFiles.Add(newFile);
// add all infotypes and categories of the read file to this system instance
MergeFileInfoTypesCategories(newFile);
// check if the file has a merged files list
if( newFile.MergedFiles.Length > 0 )
{
// extract the path of the chm file (usually merged files are in the same path)
FileInfo fi = new FileInfo(chmFile);
string sPath = fi.DirectoryName;
for(int i=0; i<newFile.MergedFiles.Length; i++)
{
string sFile = newFile.MergedFiles[i];
if(sFile.Length > 0)
{
if(sFile[1] != ':') // no full path setting
{
sFile = Path.Combine(sPath, sFile);
}
MergeFile(sFile, dmpInfo, true);
}
}
// if (newFile.MergLinks.Count>0)
// RecalculateMergeLinks(newFile);
RemoveMergeLinks(); // clear all merge-links which have no target !
}
}
}
/// <summary>
/// Merges a chm file to the current help contents
/// </summary>
/// <param name="chmFile">full file path of the chm file to merge</param>
public void MergeFile(string chmFile)
{
MergeFile(chmFile, null);
}
/// <summary>
/// Merges a chm file to the current help contents
/// </summary>
/// <param name="chmFile">full file path of the chm file to merge</param>
/// <param name="dmpInfo">dumping info</param>
public void MergeFile(string chmFile, DumpingInfo dmpInfo)
{
MergeFile(chmFile, dmpInfo, false);
}
/// <summary>
/// Merges a chm file to the current help contents
/// </summary>
/// <param name="chmFile">full file path of the chm file to merge</param>
/// <param name="dmpInfo">dumping info</param>
/// <param name="mergedFileList">true if the merge is done because a merged file list
/// was found in the previously loaded CHM.</param>
internal void MergeFile(string chmFile, DumpingInfo dmpInfo, bool mergedFileList)
{
if( File.Exists(chmFile ) )
{
if( _chmFiles.Count == 1)
{
// if we open the first file, we directly point into the toc and index of this file.
// So that we don't merge the new toc's indexe's into the first file, we have to
// clone the internal arraylists first to a new instance of the toc/index holder classes.
ArrayList atoc = _toc.TOC;
ArrayList alinks = _index.ALinks;
ArrayList klinks = _index.KLinks;
_toc = new TableOfContents();
_index = new Index();
_toc.MergeToC( atoc );
_index.MergeIndex( alinks, IndexType.AssiciativeLinks );
_index.MergeIndex( klinks, IndexType.KeywordLinks );
}
CHMFile newFile = new CHMFile(this, chmFile, dmpInfo);
if(mergedFileList) // if we've called this method due to a merged file list merge
{
RecalculateMergeLinks(newFile);
_toc.MergeToC( newFile.TOC, _chmFiles );
_index.MergeIndex( newFile.IndexALinks, IndexType.AssiciativeLinks );
_index.MergeIndex( newFile.IndexKLinks, IndexType.KeywordLinks );
_chmFiles.Add(newFile);
// add all infotypes and categories of the read file to this system instance
MergeFileInfoTypesCategories(newFile);
}
else
{
_toc.MergeToC( newFile.TOC, _chmFiles );
_index.MergeIndex( newFile.IndexALinks, IndexType.AssiciativeLinks );
_index.MergeIndex( newFile.IndexKLinks, IndexType.KeywordLinks );
_chmFiles.Add(newFile);
// add all infotypes and categories of the read file to this system instance
MergeFileInfoTypesCategories(newFile);
// check if the file has a merged files list
if( newFile.MergedFiles.Length > 0 )
{
// extract the path of the chm file (usually merged files are in the same path)
FileInfo fi = new FileInfo(chmFile);
string sPath = fi.DirectoryName;
for(int i=0; i<newFile.MergedFiles.Length; i++)
{
string sFile = newFile.MergedFiles[i];
if(sFile.Length > 0)
{
if(sFile[1] != ':') // no full path setting
{
sFile = Path.Combine(sPath, sFile);
}
MergeFile(sFile, dmpInfo, true);
}
}
RemoveMergeLinks(); // clear all merge-links which have no target !
}
}
}
}
/// <summary>
/// Checks all Merg-links read till now. Checks if the merg-link points to the
/// file <c>currentFile</c>. If yes the link will be replaced by the contents of the
/// merged file.
/// </summary>
/// <param name="currentFile">Current CHMFile instance</param>
internal void RecalculateMergeLinks(CHMFile currentFile)
{
foreach(CHMFile curFile in _chmFiles)
{
if( curFile.MergLinks.Count > 0)
{
for(int i=0; i<curFile.MergLinks.Count; i++)
{
TOCItem curItem = curFile.MergLinks[i] as TOCItem;
string sMerge = curItem.MergeLink;
string [] sSplit = sMerge.Split( new char[]{':'} );
string sFName = "";
string sTarget = "";
if( sSplit.Length > 3) // merge info contains path name
{
sFName = sSplit[0] + ":" + sSplit[1];
sTarget = sSplit[3];
}
else if( sSplit.Length == 3)// merge info contains only file name
{
FileInfo fi = new FileInfo(currentFile.ChmFilePath);
string sPath = fi.DirectoryName;
string sFile = sSplit[0];
if(sFile.Length > 0)
{
if(sFile[1] != ':') // no full path setting
{
sFile = Path.Combine(sPath, sFile);
}
}
sFName = sFile;
sTarget = sSplit[2];
}
ArrayList arrToc = null;
if( (sFName.Length>0) && (sTarget.Length>0) )
{
// if this link points into the current file
if( sFName.ToLower() == currentFile.ChmFilePath.ToLower() )
{
if(sTarget.ToLower().IndexOf(".hhc") >= 0)
{
string sfCheck = sTarget;
// remove prefixing ./
while( (sfCheck[0]=='.') || (sfCheck[0]=='/') )
{
sfCheck = sfCheck.Substring(1);
}
if( currentFile.ContentsFile.ToLower() != sfCheck )
{
arrToc = currentFile.ParseHHC( sTarget );
if( arrToc.Count > 0)
{
}
}
else
{
arrToc = currentFile.TOC;
}
// target points to a complete TOC
int nCnt = 0;
foreach(TOCItem chkItem in arrToc)
{
if(nCnt == 0)
{
curItem.AssociatedFile = currentFile;
curItem.Children = chkItem.Children;
curItem.ChmFile = currentFile.ChmFilePath;
curItem.ImageIndex = chkItem.ImageIndex;
curItem.Local = chkItem.Local;
curItem.MergeLink = chkItem.MergeLink;
curItem.Name = chkItem.Name;
curItem.TocMode = chkItem.TocMode;
curItem.TopicOffset = chkItem.TopicOffset;
MarkChildrenAdded(chkItem.Children, curFile.MergLinks);
}
else
{
ArrayList checkList = null;
if(curItem.Parent != null)
checkList = curItem.Parent.Children;
else
checkList = curFile.TOC;
int nIdx = checkList.IndexOf(curItem);
if((nIdx+nCnt)>checkList.Count)
checkList.Add(chkItem);
else
checkList.Insert(nIdx+nCnt, chkItem);
curFile.MergLinks.Add(chkItem);
MarkChildrenAdded(chkItem.Children, curFile.MergLinks);
}
nCnt++;
}
}
else
{
// target points to a single topic
TOCItem chkItem = currentFile.GetTOCItemByLocal(sTarget);
if(chkItem != null)
{
curItem.AssociatedFile = currentFile;
curItem.Children = chkItem.Children;
curItem.ChmFile = currentFile.ChmFilePath;
curItem.ImageIndex = chkItem.ImageIndex;
curItem.Local = chkItem.Local;
curItem.MergeLink = chkItem.MergeLink;
curItem.Name = chkItem.Name;
curItem.TocMode = chkItem.TocMode;
curItem.TopicOffset = chkItem.TopicOffset;
curFile.MergLinks.Add(chkItem);
MarkChildrenAdded(chkItem.Children, curFile.MergLinks);
}
}
}
}
}
}
}
}
/// <summary>
/// Adds sub-items of an TOC-entry to the merg-linked list.
/// This will mark this item as "added" during the extra merge run
/// of the HtmlHelpSystem class.
/// </summary>
/// <param name="tocs">TOCItem list</param>
/// <param name="merged">Arraylist which holds the merged-items</param>
internal void MarkChildrenAdded(ArrayList tocs, ArrayList merged)
{
foreach(TOCItem curItem in tocs)
{
if(!merged.Contains(curItem))
{
merged.Add(curItem);
MarkChildrenAdded(curItem.Children, merged);
}
}
}
/// <summary>
/// Removes merge-links from the toc of files which were not loaded
/// </summary>
internal void RemoveMergeLinks()
{
foreach(CHMFile curFile in _chmFiles)
{
if( curFile.MergLinks.Count > 0)
{
while(curFile.MergLinks.Count > 0)
{
TOCItem curItem = curFile.MergLinks[0] as TOCItem;
if(curItem.MergeLink.Length > 0)
curFile.RemoveTOCItem(curItem);
curFile.MergLinks.RemoveAt(0);
}
}
}
}
/// <summary>
/// Merges the information types and categories read by the CHMFile instance
/// into the system instance
/// </summary>
/// <param name="chmFile">file instance</param>
private void MergeFileInfoTypesCategories(CHMFile chmFile)
{
if(chmFile.HasInformationTypes)
{
for(int i=0; i<chmFile.InformationTypes.Count;i++)
{
InformationType curType = chmFile.InformationTypes[i] as InformationType;
InformationType sysType = GetInformationType( curType.Name );
if( sysType == null)
_informationTypes.Add(curType);
else
curType.ReferenceCount++;
}
}
if(chmFile.HasCategories)
{
for(int i=0; i<chmFile.Categories.Count;i++)
{
Category curCat = chmFile.Categories[i] as Category;
Category sysCat = GetCategory( curCat.Name );
if(sysCat == null)
_categories.Add(curCat);
else
curCat.ReferenceCount++;
}
}
}
/// <summary>
/// Removes the information types and categories read by the CHMFile instance
/// </summary>
/// <param name="chmFile">file instance</param>
private void RemoveFileInfoTypesCategories(CHMFile chmFile)
{
if(chmFile.HasInformationTypes)
{
for(int i=0; i<chmFile.InformationTypes.Count;i++)
{
InformationType curType = chmFile.InformationTypes[i] as InformationType;
InformationType sysType = GetInformationType( curType.Name );
if(sysType != null)
{
sysType.ReferenceCount--;
if(sysType.ReferenceCount<=0)
_informationTypes.Remove(sysType);
}
}
}
if(chmFile.HasCategories)
{
for(int i=0; i<chmFile.Categories.Count;i++)
{
Category curCat = chmFile.Categories[i] as Category;
Category sysCat = GetCategory( curCat.Name );
if(sysCat != null)
{
sysCat.ReferenceCount--;
if(sysCat.ReferenceCount<=0)
_categories.Remove(sysCat);
}
}
}
}
/// <summary>
/// Removes a chm file from the internal file collection
/// </summary>
/// <param name="chmFile">full file path of the chm file to remove</param>
public void RemoveFile(string chmFile)
{
int nIdx = -1;
CHMFile removeInstance=null;
foreach(CHMFile curFile in _chmFiles)
{
nIdx++;
if( curFile.ChmFilePath.ToLower() == chmFile.ToLower() )
{
removeInstance = curFile;
break;
}
}
if(nIdx >= 0)
{
_toc.Clear(); // forces a rebuild of the merged toc
_index.Clear(); // force a rebuild of the merged index
RemoveFileInfoTypesCategories(removeInstance);
_chmFiles.RemoveAt(nIdx);
}
}
/// <summary>
/// Closes all files and destroys TOC/index
/// </summary>
public void CloseAllFiles()
{
for(int i=0; i < _chmFiles.Count; i++)
{
CHMFile curFile = _chmFiles[i] as CHMFile;
_chmFiles.RemoveAt(i);
curFile.Dispose();
i--;
}
_chmFiles.Clear();
_toc.Clear();
_index.Clear();
_informationTypes.Clear();
_categories.Clear();
}
/// <summary>
/// Gets an array of loaded chm files.
/// </summary>
public CHMFile[] FileList
{
get
{
CHMFile[] ret = new CHMFile[ _chmFiles.Count ];
for(int i=0;i<_chmFiles.Count;i++)
ret[i] = (CHMFile)_chmFiles[i];
return ret;
}
}
/// <summary>
/// Returns true if the HtmlHelpSystem instance contains 1 or more information types
/// </summary>
public bool HasInformationTypes
{
get { return (_informationTypes.Count>0); }
}
/// <summary>
/// Returns true if the HtmlHelpSystem instance contains 1 or more categories
/// </summary>
public bool HasCategories
{
get { return (_categories.Count>0); }
}
/// <summary>
/// Gets an ArrayList of <see cref="InformationType">InformationType</see> items
/// </summary>
public ArrayList InformationTypes
{
get { return _informationTypes; }
}
/// <summary>
/// Gets an ArrayList of <see cref="Category">Category</see> items
/// </summary>
public ArrayList Categories
{
get { return _categories; }
}
/// <summary>
/// Gets the information type specified by its name
/// </summary>
/// <param name="name">name of the information type to receive</param>
/// <returns>Returns the Instance for the name or null if not found</returns>
public InformationType GetInformationType(string name)
{
if(HasInformationTypes)
{
for(int i=0; i<_informationTypes.Count;i++)
{
InformationType iT = _informationTypes[i] as InformationType;
if(iT.Name == name)
return iT;
}
}
return null;
}
/// <summary>
/// Gets the category specifiyd by its name
/// </summary>
/// <param name="name">name of the category</param>
/// <returns>Returns the Instance for the name or null if not found</returns>
public Category GetCategory(string name)
{
if(HasCategories)
{
for(int i=0; i<_categories.Count;i++)
{
Category cat = _categories[i] as Category;
if(cat.Name == name)
return cat;
}
}
return null;
}
/// <summary>
/// Gets the default topic
/// </summary>
public string DefaultTopic
{
get
{
if( _chmFiles.Count > 0 )
{
foreach(CHMFile curFile in _chmFiles)
{
if( curFile.DefaultTopic.Length > 0)
{
return curFile.FormURL( curFile.DefaultTopic );
}
}
}
return "about:blank";
}
}
/// <summary>
/// Gets a merged table of contents of all opened chm files
/// </summary>
public TableOfContents TableOfContents
{
get
{
if( _chmFiles.Count > 0 )
{
if( _toc.Count() <= 0)
{
// merge toc of files
foreach(CHMFile curFile in _chmFiles)
{
_toc.MergeToC( curFile.TOC );
}
}
}
return _toc;
}
}
/// <summary>
/// Gets a merged index of all opened chm files
/// </summary>
public Index Index
{
get
{
if( _chmFiles.Count > 0 )
{
if( (_index.Count(IndexType.KeywordLinks)+_index.Count(IndexType.AssiciativeLinks)) <= 0)
{
// merge index files
foreach(CHMFile curFile in _chmFiles)
{
_index.MergeIndex( curFile.IndexKLinks, IndexType.KeywordLinks);
_index.MergeIndex( curFile.IndexALinks, IndexType.AssiciativeLinks);
}
}
}
return _index;
}
}
/// <summary>
/// Gets a flag if the current instance offers a table of contents
/// </summary>
public bool HasTableOfContents
{
get
{
return (TableOfContents.Count() > 0);
}
}
/// <summary>
/// Gets a flag if the current instance offers an index
/// </summary>
public bool HasIndex
{
get
{
return (HasALinks || HasKLinks);
}
}
/// <summary>
/// Gets a flag if the index holds klinks
/// </summary>
public bool HasKLinks
{
get
{
return (_index.Count(IndexType.KeywordLinks) > 0);
}
}
/// <summary>
/// Gets a flag if the index holds alinks
/// </summary>
public bool HasALinks
{
get
{
return (_index.Count(IndexType.AssiciativeLinks) > 0);
}
}
/// <summary>
/// Gets a flag if the current instance supports fulltext searching
/// </summary>
public bool FullTextSearch
{
get
{
bool bRet = false;
foreach(CHMFile curFile in _chmFiles)
{
bRet |= curFile.FullTextSearch;
}
return bRet;
}
}
/// <summary>
/// Performs a full-text search over the chm files
/// </summary>
/// <param name="words">words to search</param>
/// <param name="partialMatches">true if partial word should be matched also
/// ( if this is true a search of 'support' will match 'supports', otherwise not )</param>
/// <param name="titleOnly">true if titles only</param>
/// <returns>A DataTable containing the search hits</returns>
public DataTable PerformSearch(string words, bool partialMatches, bool titleOnly)
{
return PerformSearch(words, -1, partialMatches, titleOnly);
}
/// <summary>
/// Performs a full-text search over the chm files
/// </summary>
/// <param name="words">words to search</param>
/// <param name="MaxResults">maximal number of hits to return</param>
/// <param name="partialMatches">true if partial word should be matched also
/// ( if this is true a search of 'support' will match 'supports', otherwise not )</param>
/// <param name="titleOnly">true if titles only</param>
/// <returns>A DataTable containing the search hits</returns>
public DataTable PerformSearch(string words, int MaxResults, bool partialMatches, bool titleOnly)
{
if( ! FullTextSearch )
return null;
DataTable dtResult = null;
int nCnt = 0;
foreach(CHMFile curFile in _chmFiles)
{
if(nCnt == 0)
{
if(curFile.FullTextSearchEngine.CanSearch)
{
if(curFile.FullTextSearchEngine.Search(words, MaxResults, partialMatches, titleOnly))
{
dtResult = curFile.FullTextSearchEngine.Hits;
dtResult.DefaultView.Sort = "Rating DESC";
}
}
}
else
{
if(curFile.FullTextSearchEngine.CanSearch)
{
if(curFile.FullTextSearchEngine.Search(words, MaxResults, partialMatches, titleOnly))
{
DataTable table = curFile.FullTextSearchEngine.Hits;
// append rows from 2nd file
foreach(DataRow curRow in table.Rows)
{
dtResult.ImportRow( curRow );
}
dtResult.DefaultView.Sort = "Rating DESC";
// adjust max hits
if(MaxResults >= 0)
{
if(dtResult.DefaultView.Count > MaxResults)
{
for(int i=MaxResults-1; i<dtResult.DefaultView.Count-1;i++)
{
if(dtResult.DefaultView[i].Row.RowState != DataRowState.Deleted)
{
dtResult.DefaultView[i].Row.Delete();
dtResult.DefaultView[i].Row.AcceptChanges();
i--;
}
}
dtResult.AcceptChanges();
dtResult.DefaultView.Sort = "Rating DESC";
}
}
}
}
}
nCnt++;
}
return dtResult;
}
}
}

Some files were not shown because too many files have changed in this diff Show More