yashsingh1/xdaforums huggingface dataset:
[Windows Phone 7 Development and Hacking] dcordes:
GoodDayToDie, welcome, it's grea to see you here :cool: I was already plotting how to ask you to take a look at this. Your HtcRoot project looks much like what HaRET needs since we had to resect its ability to boot Linux (see patch below).

Thanks for all the insight on changes in WP7. Is this stuff documented somewhere?

Regarding the user mode Linux: With regard to requirements of the Linux drivers to access hardware in order to really use it has a phone I think it will be an interesting thing, but in the long run it would be nicer to use real kernel mode.

What determines whether or not a WP7 rom has working HtcUtility and how exactly would we implement this to provide Kernel mode ?

Would that driver to call IOCTLs run seperately or could it be integrated within HaRET ? As "standalone" it could also be interesting for other uses but also complicate HaRET use ?..

How can one obtain those WP7 sources ? Do you need some license in order to get them as non-warez ?

I think we need to get kernel mode not only when booting Linux but also for the analytic features such as dumping memory etc. (see crash on attempt to dump memory management unit on mozart above)

Here's where SetKmode was used. On proposition of minDark I removed it and it got rid of the crash:

haret$ git diff
diff --git a/src/memory.cpp b/src/memory.cpp
index ccba659..53c0826 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -320,7 +320,7 @@ err: VirtualFree (pmWindow, 0, MEM_RELEASE);
if (slot >= PHYS_CACHE_COUNT)
{
// Go into supervisor mode
- SetKMode (TRUE);
+// SetKMode (TRUE);
cli ();
cpuFlushCache ();

@@ -333,7 +333,7 @@ err: VirtualFree (pmWindow, 0, MEM_RELEASE);

// Back to user mode
sti ();
- SetKMode (FALSE);
+// SetKMode (FALSE);
}

// Move least recently used slot to front
@@ -354,12 +354,12 @@ void memPhysReset ()
if (pmInited)
{
// Go into supervisor mode
- SetKMode (TRUE);
+// SetKMode (TRUE);
cpuFlushCache ();
// Restore the page table entries
for (int i = 0; i < 16 * PHYS_CACHE_COUNT; i++)
pmPT [i] = pmOldPT [i];
- SetKMode (FALSE);
+// SetKMode (FALSE);

VirtualFree (pmL2PT, 0, MEM_RELEASE);
VirtualFree (pmWindow, 0, MEM_RELEASE);
diff --git a/src/wince/output.cpp b/src/wince/output.cpp
index cc65d40..e4be7ed 100644
--- a/src/wince/output.cpp
+++ b/src/wince/output.cpp
@@ -276,9 +276,9 @@ prepThread()
// All wince 3.0 and later machines are automatically in "kernel
// mode". We enable kernel mode by default to make older PDAs
// (ce2.x) work.
- Output("Setting KMode to true.");
- int kmode = SetKMode(TRUE);
- Output("Old KMode was %d", kmode);
+// Output("Setting KMode to true.");
+// int kmode = SetKMode(TRUE);
+// Output("Old KMode was %d", kmode);
}

// Initialize the haret application.

Btw I will happily provide anybody with write access to haret.git, but before we do any fundamental changes, we will have to go thorugh them on the mailing list (links in 1st post) in order to allow the core developers to share their opinion.
[Windows Phone 7 Development and Hacking] dcordes:
personally I have no clue how to integrate this. Just throw the lines before functions that will draw the window ?
[Windows Phone 7 Development and Hacking] GoodDayToDie:
You can get the "evaluation" copies of CE 6 and 7, including source code (it will ask you to accept the "Shared Source" license; it's pretty straightforward and fairly permissive). http://www.microsoft.com/windowsembedded/en-us/downloads/download-windows-embedded-compact-ce.aspx (link for 6.0 is in the upper left).

I think the "user-mode kernel" option requires writing a "hardware abstraction layer" that talks to the host kernel, and I'm not sure anybody has done that here, so maybe that's not practical. On the other hand, like I said, it depends on which and how many kernel-mode APIs it needs to call. Aside from memory management, which I think shouldn't be too hard, there's also the question of whether any custom interrupt handlers are needed, and how to trap them. If the amount of stuff that *must* be done in ring 0 is small enough, a driver that does it for you is possible.

Alternatively, you could have a driver that essentially *is* HaRET, and the UI would just be a usermode program that calls into this driver. I don't know how much or how little re-writing that would take; I'd need to look at the HaRET sources and architecture more to know. It wouldn't be trivial work, but it would allow calling kernel APIs without interference...

HtcUtiltity.dll is a driver that HTC ships on their Windows phones, presumably for debug purposes, which exposes an IOCTL that can read or write 4 bytes at a time from any kernel-mapped address. The HtcRoot project uses this to dump the kernel's process metadata structs, modify the security info, and write the modified data back into the kernel. That's not really what you need to do, I think, but HtcUtility could be used other ways too. For example, override the kernel-mode side of the system call function table, so that *after* the thunk to ring0, the kernel jumps to code you control (arbitrary code execution in kernel).

As for what is required for a ROM to support HtcUtility, it's a matter of which stock firmware image a given ROM's copy of the DLL (would be a .SYS on NT, probably, though that's just convention without real meaning) comes from. Most HTC ROMs include working (meaning older) versions of the HtcFileUtility and HtcProvisionDrv DLLs, because those have had known uses for a year or so now. The power of HtcUtility was only recently discovered, though. There's a list on the HtcRoot project thread of compatible and incompatible versions; it's nowhere near comprehensive but may be enough to get started.
[Windows Phone 7 Development and Hacking] spavlin:
===== HaRET pre-0.5.3-20120209_233258 ===

HaRET(14)# DUMP CP 15

EXCEPTION on access to coprocessor 15 register 0

EXCEPTION on access to coprocessor 15 register 8

c00: ffffffff | c08: ffffffff

EXCEPTION on access to coprocessor 15 register 1

EXCEPTION on access to coprocessor 15 register 9

c01: ffffffff | c09: ffffffff

EXCEPTION on access to coprocessor 15 register 2

EXCEPTION on access to coprocessor 15 register 10

c02: ffffffff | c10: ffffffff

EXCEPTION on access to coprocessor 15 register 3

EXCEPTION on access to coprocessor 15 register 11

c03: ffffffff | c11: ffffffff

EXCEPTION on access to coprocessor 15 register 4

EXCEPTION on access to coprocessor 15 register 12

c04: ffffffff | c12: ffffffff

EXCEPTION on access to coprocessor 15 register 5

EXCEPTION on access to coprocessor 15 register 13

c05: ffffffff | c13: ffffffff

EXCEPTION on access to coprocessor 15 register 6

EXCEPTION on access to coprocessor 15 register 14

c06: ffffffff | c14: ffffffff

EXCEPTION on access to coprocessor 15 register 7

EXCEPTION on access to coprocessor 15 register 15

c07: ffffffff | c15: ffffffff

HaRET(18)# bootlinux

boot KERNEL=zImage INITRD=initrd.cpio.gz

Opening file zImage

Opening file initrd.cpio.gz

boot params: RAMADDR=11800000 RAMSIZE=1e400000 MTYPE=3544 CMDLINE='init=/init rw consoleblank=0 fbcon=rotate:1'

Boot FB feedback: 1

Failed to lock 1341 pages (code 6)

-------------------------------------------------

HaRET(14)# watch GPIOS 5

Beginning memory tracing.

Terminating haret due to unhandled exception (pc=00017b68)

-------------------------------------------------

HaRET(14)# wirq 1

Terminating haret due to unhandled exception (pc=0001b1e4)
[Windows Phone 7 Development and Hacking] jdbastardy:
I can get CE 7.0 and CE6.0 as part of my Academic Alliance program with my university... Do not know about the license anyway. If you need this I can help. PM me.
[Windows Phone 7 Development and Hacking] ONDR4SH3K:
Can You upload your xap file for public testing? I have HTC Trophy with DFT V2 ROM and I wanna test. :)
[Windows Phone 7 Development and Hacking] ultrashot:
hmm code itself is pretty much self-explaining. Dirty sample code below

//

typedef HRESULT (*CREATEWINDOWTREEUPDATER)(HWND hWnd, DWORD unk, HANDLE *hWindowTreeUpdater);
typedef HRESULT (*UPDATEWINDOWTREE)(HANDLE hWindowTreeUpdater);
typedef HRESULT (*DESTROYWINDOWTREEUPDATER)(HANDLE hWindowTreeUpdater);
CREATEWINDOWTREEUPDATER createWindowTreeUpdater;
DESTROYWINDOWTREEUPDATER destroyWindowTreeUpdater;

haret.cpp:

HANDLE hWindowTreeUpdater = NULL;
static BOOL CALLBACK DialogFunc (HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
HMODULE hLibrary = LoadLibrary(L"\\Windows\\WindowTreeUpdater.dll");

createWindowTreeUpdater = (CREATEWINDOWTREEUPDATER)GetProcAddress(hLibrary, L"CreateWindowTreeUpdater");
destroyWindowTreeUpdater = (DESTROYWINDOWTREEUPDATER)GetProcAddress(hLibrary, L"DeleteWindowTreeUpdater");

createWindowTreeUpdater(hWnd, 1, &hWindowTreeUpdater);
Output("In initdialog");
MainWindow = hWnd;
wchar_t title[200];
_snwprintf(title, ARRAY_SIZE(title), L"HaRET Version %hs", VERSION);
SetWindowText (hWnd, title);
SetWindowText (GetDlgItem (hWnd, ID_SCRIPTNAME), L"default.txt");
CheckDlgButton(hWnd, IDC_COM1, BST_CHECKED);
ShowWindow (hWnd, SW_SHOWMAXIMIZED);
Screen("Found machine %s", Mach->name);
Output("executing startup.txt");
scrExecute ("startup.txt", false);
return TRUE;
}
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDOK:
case IDCANCEL:
KillWindowTreeUpdater(hWindowTreeUpdater);
EndDialog (hWnd, LOWORD (wParam));
return TRUE;

Please note that some ms controls could be damaged in wp7.
[Windows Phone 7 Development and Hacking] dcordes:
Thanks, I just copy pasted this on top of the nokmode patched source ...

Compiling (armv4) src/wince/haret.cpp
src/wince/haret.cpp: In function 'BOOL DialogFunc(HWND__*, UINT, WPARAM, LPARAM)':
src/wince/haret.cpp:57: error: 'createWindowTreeUpdater' was not declared in this scope
src/wince/haret.cpp:57: error: 'CREATEWINDOWTREEUPDATER' was not declared in this scope
src/wince/haret.cpp:57: error: expected `;' before 'GetProcAddressW'
src/wince/haret.cpp:58: error: 'destroyWindowTreeUpdater' was not declared in this scope
src/wince/haret.cpp:58: error: 'DESTROYWINDOWTREEUPDATER' was not declared in this scope
src/wince/haret.cpp:58: error: expected `;' before 'GetProcAddressW'
src/wince/haret.cpp:55: warning: unused variable 'hLibrary'
src/wince/haret.cpp:80: error: 'KillWindowTreeUpdater' was not declared in this scope
make: *** [out/haret.o] Error 1
[Windows Phone 7 Development and Hacking] ultrashot:
well, i haven't tested the code - just written it in notepad. Fix errors :D
[Windows Phone 7 Development and Hacking] ariey:
if this can be tested on HTC Mozart (WP7 1st generation)?

I am ready to volunteer for it, just PM me
[Windows Phone 7 Development and Hacking] Jaxbot:
We got Android and Ubuntu booting, but the in-call sound was robotic, which just doesn't cut it, so we ditched the project. </sarcasm>

I'm not sure what dcordes is up to, but here's my understanding. The goal of the project right now is to get HaRET working on WP7, which requires some important modifications. The previous posts have to do with restoring the GUI, which should be straightforward enough, once some issues are fixed. After that, we have to figure out how to access the kernel memory to load Linux into. It seems this is possible with the HTCUtility driver, which would be the next step after the GUI.

It's progress, basically, but rest assured that excited posters will keep you informed of any news.

Also, reminder to self: get the tools to compile HaRET on this dev machine
[Windows Phone 7 Development and Hacking] LP4E:
if this can be tested on a Lg optimus 7 (e900) i offer myself as a volunteer =)

thank you for your unbelievable work!!
[Windows Phone 7 Development and Hacking] Jaxbot:
There's no reason to test it right now, we already know it does nothing :p
[Windows Phone 7 Development and Hacking] metroidnemesis13:
When testing is needed:

Would an OS ver 7003 Samsung Taylor development prototype help out with the proj? I can test and provide a dump or something. I also have a Samsung Focus and can provide testing on that too, and an Omnia 7 on the way. Let me know.

Taken note that testing is not needed yet. My bad.
[Windows Phone 7 Development and Hacking] streetster:
What are the implications of Cotullas WML? Am guessing it wont have the correct system hooks if it's just running on top of WP7? Would be interesting to see what happens if HaRET is triggered though...

Thoughts?
[Windows Phone 7 Development and Hacking] Jaxbot:
Was going to post that ;) I'm not really sure how they're doing what they're doing, but the CE policies seem pretty bypassed, so I'd be super curious to see what HaRET would do.
[Windows Phone 7 Development and Hacking] Ttblondey:
I'm using HD7custom rom ,so of anyone ones to test tell me.
[Windows Phone 7 Development and Hacking] Jaxbot:
Woot, got HaRET to compile. Took some work, though. The wiki could use some updated instructions on compiling it, at least in regards to Ubuntu.
[Windows Phone 7 Development and Hacking] streetster:
As it's a wiki you can (presumably) add the extra steps, all I had to do (after installing git which I was surprised I didnt already have) was to add a symbollic link:

$ sudo ln -s /usr/lib/libmpfr.so.4 /usr/lib/libmpfr.so.1

and then everything was happy:

Linking out/haret-debug (Version "pre-0.5.3-20120216_150413")
Stripping out/haret-debug to make out/haret.exe
Creating tar out/haretconsole.tar.gz

Just need to a) look at the changes needed to get it to run and b) look at how to deploy an .exe to my phone :)
[Windows Phone 7 Development and Hacking] Jaxbot:
I tried that. Got several problems with the lib being different.. grabbing the 0.55 version of ce fixed it, though. I'll fill in some details when I get some time.
[Windows Phone 7 Development and Hacking] streetster:
I just got the latest which was "mingw32ce-0.59.1.tar.bz2", do you think there's any harm in using a newer version?
[Windows Phone 7 Development and Hacking] Jaxbot:
The latest version segfaults on WP7, for whatever reason.
[Windows Phone 7 Development and Hacking] divdroid:
????

I am a complete noob here...but I have seen a thread where DFT booted windows 6.5 on a windows phone device, If I remember we used to run Haret on windows mobile and boot into android...and we go this way here....I dont know how this works but just curious....run windows 6.5 and then haret... :P

It sounds dumb :P or it works thats up to you Gurus....
[Windows Phone 7 Development and Hacking] Jaxbot:
Making progress.

Actually, lots of progress. ;D

As you can see, the res is skewed quite a bit... anyone know where this stuff is handled in the source?
[Windows Phone 7 Development and Hacking] streetster:
Looking good...

I managed to remove the dependency on libgcc_s_sjlj-1.dll by adding '-static-libgcc' to the linker flag:

Checking with PE Explorer no longer shows libgcc_s_sjlj-1.dll... still miles behind everyone else who's got the executable deployed etc tho!

@Mods.. and chance we can get a cleanup of the thread to remove all the 'I'll help test' posts?
[Windows Phone 7 Development and Hacking] Jaxbot:
Make a Visual Studio project, stuff your exe in there, then execute with the DllImport library. I'll have some more info on that in a bit, but I need dcordes to chime in about how this project is going.

Do you think it would be wise to fork the old HaRET repo into a "HaRET7" or such repo? None of the changes we're making make sense for the old project, or the team behind it, and it would be nice if we could manage these changes without having to copy and paste from XDA code tags :p

+1

"Testing" is when we have something that we think works, but need to see if there are any problems. We know this doesn't work, so it isn't really testing, it's just excused time wasting.
[Windows Phone 7 Development and Hacking] streetster:
My VS install is broken, going to uninstall and re-install... will see how I get on with a fresh install.

That's probably a wise move.. means people can pull down all the changes with the progress we've made so far (hah we... you've!), and also commit WP7 specific changes too...

Exciting times :)
[Windows Phone 7 Development and Hacking] Jaxbot:
Yeah, waiting to see dcordes' response, then I'll commit all my changes over to wherever we're managing this at. Everything works great so far.. except, you know, booting linux :p
[Windows Phone 7 Development and Hacking] streetster:
Ahh don't worry about the details... minor issues :)

Am looking forward to hearing from GoodDayToDie too.
[Windows Phone 7 Development and Hacking] metroidnemesis13:
Right on. Should have known better. I guess my overzealousness to help out got in the way of my brain.

P.S.:

92 // Try GETGXINFO method.
93 GXDeviceInfo rfb;
94 rfb.Version = 100;
95 hdc = GetDC(NULL);
96 ret = ExtEscape(hdc, GETGXINFO, 0, NULL, sizeof(rfb), (char*)&rfb);
97 ReleaseDC(NULL, hdc);
98 if (ret > 0) {
99 videoW = rfb.cxWidth;
100 videoH = rfb.cyHeight;
101 return (uint16 *)rfb.pvFrameBuffer;
102 }
103

Lines 99 and 100 of video.cpp looks like it handles screen size and resolution from the raw frame buffer. Probably already figured that out... [/end poor help]

Also it looks like your actual video comes from this file and it's taking cyHeight and cyWidth from here:

http://git.linuxtogo.org/?p=groups/...8;hb=ef3a2d0b0791cd733627ebf3c2d1e5232527764b
[Windows Phone 7 Development and Hacking] Jaxbot:
Changing the video.cpp frame width/height did nothing.. I'll play around once I get some time.
[Windows Phone 7 Development and Hacking] Jaxbot:
Save your bandwidth, we'd be lucky to get Android actually booting and running properly in a month :P

Also, this wouldn't work on the Optimus7, because you need a full unlocked rom.
[Windows Phone 7 Development and Hacking] metroidnemesis13:
You might try that gx file in the include directory. In the comments it also says something about inheriting the graphics properties (i.e., resolution) from a dll? Perhaps this is a system dll locally in WinMo specific to the device? This is just speculation though since I haven't had time to really look at it.

If you guys want I can try to help. I am more of a high level programmer so I may not be able to help that well with this C and assembly stuff and all this bit twiddling.

I'll bet by the time this thing gets off the ground, there will be more custom and unlocked roms for all WP7 devices. It's too early to know, so the answer you get now may or may not even be valid, so there's probably no point in worrying about it now.
[Windows Phone 7 Development and Hacking] Jaxbot:
I would love to, but it's not my source/project and thus I'm waiting for approval from dcordes before I do anything.

In the meantime, I should also clean up some source.
[Windows Phone 7 Development and Hacking] metroidnemesis13:
If you and others would have read a page back you'd figure out that no one knows at this time, so there is zero point in asking, like Jaxbot and I literally just said.

Don't ask for ETAs ever or compatibility at this time please. Thank you.
[Windows Phone 7 Development and Hacking] O_G:
Thread Cleaned​

Please only post if you have something to contribute. Also please avoid posting thank you we have a "thanks" button for that.

Stop with the ETA posts, it just annoys the good developers. Just be grateful for the work they do!​
[Windows Phone 7 Development and Hacking] spavlin:
TCPMP

Subtitle Edition

0.81RC1 Beta crash report

----------------------------

Unknown(00000057) at 47081edd (:47081edd)

cpu dump:

R0 = 00000057

R1 = 00000001

R2 = 00000000

R3 = 00000000

R4 = 0001075c

R5 = 03cc3ef0

R6 = 00000008

R7 = 00000001

R8 = 03cc3860

R9 = 03cc0960

R10 = 47028e74 (common:00077e74)

R11 = 03cbfb10

R12 = 805399ec

Sp = 03cbfb04

Lr = 8053911c

Pc = 47081edd

Psr = 60000130

common 46fb1000-47038000 obj:0 class:38

General (0x03cc2e20)

Language(16)=1600083282

Platform(23)=SmartPhone

Ver(25)=710

OS Version(27)=7.10

OEM Info(24)=HTC

TypeNo(26)=2

Model(18)=0

Caps(19)=0x00000001

Processor(17)=ARM

Clock speed(34)=520

(37)=9

(38)=0

Advanced (0x03cc2fe0)

System Timer (0x03e90990)

Wave Output (0x03cc3060)

GAPI (0x03cc3360)

DirectDraw (0x03cc3860)
[Windows Phone 7 Development and Hacking] Bongo2k:
I assume by "fully unlocked" you don't mean the Venue Pro?
[Windows Phone 7 Development and Hacking] Omnia7xdax:
Yes the OmniaW,DELL Venue Pro,LG and 2nd GEN devices which have no dft freedomrom can´t use haret,that´s in some case very sad but that´s the way it is
[Windows Phone 7 Development and Hacking] Ttblondey:
Is there anyway or someone create another ATools for WP7 or NAND alike.
[Windows Phone 7 Development and Hacking] GoodDayToDie:
Considering that the Venue Pro can't either be interop-unlocked nor have the bootloader unlocked (for custom ROMs), that's a pretty safe assumption.

Hey folks, I'm back, sorry for the brief absence. I'm going to start taking a look at HaRET's kernel-mode calls (stuff it would need to do for full system access) and see if I can use HtcUtility to write an abstraction layer for that. No guarantees on time, though - I'm pretty sure it can be done, but this is different from what the HtcRoot project does.

I do still have some other projects (including getting myself hired, which takes a chunk of my time), but I want to work on something else for a bit, and HaRET looks like just the thing. Note though: I don't actually have much of a WinMo/WinCE background, so adapting what used to be possible to what is possible now will take some learning.
[Windows Phone 7 Development and Hacking] domineus:
don't be so sure

dvp I believe has a fully unlocked b/l

nosker and others are trying to get a custom rom on it as we speak...have been since about late december...

check the dvp dev and hacking forums
[Windows Phone 7 Development and Hacking] ted973:
i don't think a custom rom is possiable.FFU is signed as other WP7 Roms.
[Windows Phone 7 Development and Hacking] domineus:
http://xdaforums.com/showthread.php?t=1429523

it's being worked on...
[Windows Phone 7 Development and Hacking] ajlunis:
Where can we donate? ;)
[Windows Phone 7 Development and Hacking] dcordes:
Did anybody try hitting listen button in jaxbot's fixed haret.exe and connect to localhost via a local or remote telnet client or remote haretconsole.py ?

It's GPL code. No problem to do any copies of the tree just don't remove the COPYING file :)

Is it possible for haret.exe to check for OS version (#ifdef wp7 ... ) and include the GUI and kernel mode hacks accordingly? If so we should consider that, stay compatbile and continue on http://git.linuxtogo.org/?p=groups/haret/haret.git

Why do a complete WP7 fork if it's not needed ?
[Windows Phone 7 Development and Hacking] Jaxbot:
We could, but there are so many changes that are necessary, it just doesn't make sense imho to keep it on the same repo. And when we start looking at using kernel drivers, things will just get more sticky.

Plus, we have to manage a Silverlight project for the launcher, which would have no place on the original repo.

We could try to dodge around some things and keep it on the same project, but really, so many changes will need to be made, I vote we just fork the whole thing and put it on github. But that's just my 2 cents.
[Windows Phone 7 Development and Hacking] jessenic:
I'm with GitHub too, easy to use issue tracker, milestones, wikis and even a website can be created there.
[Windows Phone 7 Development and Hacking] spavlin:
GitHub +1

github.com

On GitHub it is possible to create one Free public repositories free of charge

http://www.git-scm.com/

git://github.com/haret/haret.git - Read+Write access
[Windows Phone 7 Development and Hacking] jdbastardy:
I haven't much word since I am not a collaborator but I suggest bitbucket. It's easier than github and in my opinion better.

https://bitbucket.org/
[Windows Phone 7 Development and Hacking] Jaxbot:
The question here isn't what service to use. The question is whether we fork the project. Since dcordes is the OP, and knows a lot about the original project and it's team, I'm asking for his thoughts. If he approves of my suggestion, I'll move all my modified source over to a service of my liking.
[Windows Phone 7 Development and Hacking] jdbastardy:
Yep you're right. When it will be public I may try to have a look and provide something now that I am out of my midterms.