Anyone tried lua.vxp from rephone ? - Other SmartWatches

I"ve found a nice VXP, i still not tried it for fear of bricking by smartwatch. Once upon a time, there was a RePhone based on MT2502, and it was possible to develop in Lua for it.
I've found it here :
Lua for RePhone
Its for MT2502 but i believe it count be adapted for later mediatek models...
Lua is a nice language to develop, we could make all the missing features, like twitter, facebook etc, maybe we cannot do a brower or youtube client, but many simpler things could be done using lua, including new watchfaces etc...
While i am not a C++ developer, i can help with Lua development.
We can cheaply have an equivalent to Watchy (that costs $50 bucks).
Edit :
Also found the following :
Lua on RePhone manual
unfotunately is paywalled.
Edit 2:
Further search yielded a firmware that has only Lua language :
Lua firmware for MT2502
I dont recommending flashing your smartwatch right away because we need more information.
In other words, it could do a smartwatch solely based on lua apps. Lua watchfaces etc.
Edit 3:
By searching the source code i see that :
1 - It runs init.lua if called as an app.
2 - It assumes the device to have an ST7789S as screen, might be wrong.
3 - It retargets the i/o to the serial port. Might be usefull to not have any character i/o at all.
From what i found in the source code, it calls init.lua then proceeds to create a console to accept commands, that might not be the right behaviour for writing smartwatch apps (maybe, start, run arbitary lua file from command line preferably, then quit).
Edit4:
MRE Programming Tutorial
Basic structure of MediaTek MRE programming.

Related

decomiling and recompiling - newb question

Hi,
Can someone assist me with how i might go about decompiling or viewing a dll, making changes to it and recompiling it? What tools can i use to do this?
I have tried copying some of the dlls from my device over to my local pc, however most of the time i get an "access violation" message.
Further, i realize i can use idlasm to disassemble .net files, but it seems most of the more interesting dlls and files may be standard c dlls. How can i take a look at the code in these and modify if wanted?
thanks much.
farseer: what level of experience do you have?
V
I'd like to think i am decent developer, but that may be in my own mind
However, i do not do a lot of "hacking", i.e., have not had the need to do much reverse engineering. I have been coding ground up apps for over 10 years however, uisng C++, Java, C#, VB, etc. You name the language, and i've probably done something in it .
vijay555 said:
farseer: what level of experience do you have?
V
Click to expand...
Click to collapse
was that the wrong answer?
farseer said:
I'd like to think i am decent developer, but that may be in my own mind
However, i do not do a lot of "hacking", i.e., have not had the need to do much reverse engineering. I have been coding ground up apps for over 10 years however, uisng C++, Java, C#, VB, etc. You name the language, and i've probably done something in it .
vijay555 said:
farseer: what level of experience do you have?
V
Click to expand...
Click to collapse
Click to expand...
Click to collapse
The correct answer should be "I know ARM assembler language, the structure of Win32 PE files, I know what is XIP DLL and why I cannot modify them directly, and I have read the WM5 source code".
In this case the process is simple - you decompile a DLL with IDA (www.datarescue.com), find the place you need, modify the code to suit your needs - and that is all. In most cases there is not enough place in DLL for your code, so you need to use virus-like techniques, my prefered method is to patch the code so that it loads my DLL and run it instead of original code. Or use some other hooking methods so that my code is executed instead of original.
Ah, thanks much, this was helpful. I do have a few follow up questions:
1. Is "Arm assembler" different than standard assembler? If so, any suggested readings?
2. There are some dlls that cannot be copied to my local pc (i get an access violation i believe). How does one extract an image of such dlls?
3. Where is the WM5 source code? and why would i need to read this to be able to hack/patch dlls?
thanks again.
mamaich said:
The correct answer should be "I know ARM assembler language, the structure of Win32 PE files, I know what is XIP DLL and why I cannot modify them directly, and I have read the WM5 source code".
In this case the process is simple - you decompile a DLL with IDA (www.datarescue.com), find the place you need, modify the code to suit your needs - and that is all. In most cases there is not enough place in DLL for your code, so you need to use virus-like techniques, my prefered method is to patch the code so that it loads my DLL and run it instead of original code. Or use some other hooking methods so that my code is executed instead of original.
Click to expand...
Click to collapse
Hi farseer!
I am nowhere near the level of mamaich or vijay555 but I have some experience in this and I believe I can give you some basic answers:
1. ARM is a different architecture then x86 processors and the assembler is different to accommodate it. There are some basic similarities like mov add and such, but even the registers are different (R0 - R15 if I am not mistaken). Sorry, I don't know any books on it, but if you google you will quickly find the list of commands with basic explanation.
2. Since the OS is in ROM you can't just copy and paste it's DLLs and EXEs. Look for ROM dumping tools on this forum, or already extracted images on the ftp. Keep in mind MS did some tricks to save memory and make it harder to get at the files, so like mamaich said, you need to learn about XIP and the ROM structure in general to understand whats going on.
3. Hmm... MS does have a program for sharing most of WM source code, but it's not for common people like us. (check out their site to see what I mean) I suspect there are other sources of getting the parts necessary to understand DLL hooking, but I have no idea what they might be.
Well that's my two cents until an expert can answer you. Hope this helps.
farseer: you gave a perfectly good answer IMHO, just needed to get an idea of what level to pitch a response without talking up or down to you!
It's well documented that I'm a self confessed newb to c++, and would say that your programming skills should certainly hold you in good stead. However, having a good knowledge of the Win32 API is certainly beneficial.
For decompiling, basically IDA. There is an IDA demo available on their website that should get you going, it's pretty much 100% functional other then it won't save, and closes itself (or crashes itself) after a reasonable, random period of time. IDA is "the daddy" for pretty much all mainstream reversing, although you could write your own decompiler/debugger.
Recompiling - that's a toughy. IDA won't permit recompiling on ARM AFAIK.
You'll have to hexedit into the target and patch directly. Otherwise you get into the exciting world of code injection, hooking etc, as Mamaich says.
For that area, read everything he's ever written, before you start reversing
Oh, and a helpful hint to all. Don't just read what Mamaich's written on this board, his posts on other boards are even more useful!
It's worth getting a good familiarity with reversing on x86 first, get used to how IDA works etc (and Soft Ice is very useful to give a good insight into x86, although AFAIK it's not available for WinCE). ARM assembler is different, but just grab a list of the opcodes and read through a few CPU developers' guides (online).
There are a number of tutorials on reversing ARM stuff online. In the usual places for that kind of stuff.
For getting access to the ROM files, easiest way is to grab a rom update file and decrypt it. Mamaich is once again your man, his romtools do the job. He also has a "live" rom grabber, that'll grab all the files/modules out of your running phone for your perusal.
Platform Builder is available free to give you (some) WinCE source code. Not all, but enough to give you years worth of reading.
V
Thanks all...very kind of you to respond in such detail. I look forward to dabbling a bit with IDA and some of mamaich tools. I suppose the first order of business is to do a lil more research and then just dive in! It's been a while since i wrote any assembly code (not since college!), but i am a bit excited at having an excuse to do so again.
thanks again.
Just remember that unless you really luck out and the developer left the symbol table intact, you're going to end up with garbage for the names of variables and subroutines.
I hate reading decompiled code.

[Develop] How to combin the DLL and EXE

I had developed a software. The software are using the external dll library, how can I compile the exe embedded *.dlls??
PS: I am using a VS 2005, Language: VB.net
Also I would like to know how to protect my application code avoid the decompiler to decompile ???
sorry for my poor english.
Welcome to the forum.
Your English is fine, but unfortunately there is no simple answer to your questions.
I will start with the last one first:
There is no one simple way to protect your code. There are whole books and articles written on it and if you google you will even find commercial products that "scramble" compiled apps to make it difficult to disassemble and reverse engineer.
Unfortunately I can not give you more specific info like book titles since I am not too interested on the subject.
I can tell you this: whether you app gets hacked or not is a matter of how much it costs vs. how useful / desirable it is. That means that if your program is really grate and everyone wants it but it costs a lot someone will put in the effort and eventually crack it no matter what you do.
As for your first question: unless you have source code or the obj files for the DLL to link to there is no way to combine it with your exe. If something was released as a DLL library and only as a DLL library it will remain just that.
Like mentioned above; the only possibility to 'protect' your .NET application is to obfuscate the code. there are some good (but commercial) tools out there. Google for it and if you're lucky you can find a comparison as well. (hopefully somebody tested some tools already to compare them)
You cannot recompile a DLL unless you've the source code as well.
it's easier to do if one dont use .net

Lets Built OpenSource Projects for PPC. 6 Projects Posted. Updated 7th Feb 2008.

NOTES:
The projects if developed will become a generic code baseline for each and every developer seeking codes.
This means projects in this thread is just to give everyone a basic working conceptual code which can be used anywhere in similar projects.
Just think people has great ideas to work on, but they dont have baseline code from where to start as most of them might be learning.
So this thread should help them out giving a working base code..
Any1 interested in building couple of OpenSource Projects for PPC? Ill post concepts.
Lets built next generations of applications together as open source which people can use to learn things as well.
The reason open source is so that everyone can contribute code for a project, and work together to built the best.
Anyone Interested???
------------------------------------------------------------------------------------------------------------------
Project 1: File Indexer for PPC [FIndexer]
Not Sure if it exists or already available.
Added:
01 Feb 2008
Description:
To index each and every file on PPC with custom options on indexing.
Purpose:
In todays world where 1gb,2gb,4gb cards are available, we store tons of file on our PPC like ebooks, songs, music, videos.
Many times it is not possible to search using a search utility as it may consume battery and we need to wait till file is being search.
This is the place where this FIndexer comes in to picture, where we index our file either manualy or scheduled.
And then searching a file will just take 1 second to return the results.
Language:
C++ is best language for this kind of project because of speed.
Database:
Not sure, but either SQL or Access DB.
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Project 2: File System for PPC [PFS (Pocket File System)]
Not Sure if it exists or already available.
Added:
01 Feb 2008
Description:
Idea came from Microsoft new file system WinFS.
Correct me if i am wrong, this File system is a file table itself where it keeps track of each and every files in details in Real Time.
Purpose:
In todays world where 1gb,2gb,4gb cards are available, we store tons of file on our PPC like ebooks, songs, music, videos.
Many times it is not possible to search using a search utility as it may consume battery and we need to wait till file is being search.
This is the place where this PFS comes in to picture.
Why use any indexing software also?, let this File system handle it in real time.
Language:
C++ is best language for this kind of project because of speed.
Database:
Not sure, but either SQL or Access DB.
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Project 3: Tic Tac Toe (x & 0) Game (BlueTooth Enabled)
Not Sure if it exists or already available.
Added:
01 Feb 2008
Description:
This is a game which we always played for fun in good old days and still we play.
We might have wasted good amount of papers to play this game. Classic X & 0
Purpose:
We hardly see any bluetooth enabled games for PPC. Thats the purpose to built a very basic game with 2 players mode on bluetooth.
This may be a good code for all the developers round here who wants to start with some bluetooth code.
Language:
C++ is best language for this kind of project because of speed.
Database:
Not sure, but either SQL or Access DB or XML
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Project 4: Multipurpose Single Line Marquee Scrolling Today Screen Plugin [Like Stock Tickers]
Not Sure if it exists or already available.
Added:
01 Feb 2008
Description:
A today plugin which scrolls like a stock ticker in 1 or 2 lines, and provides useful configurable information like battery info, world time, live money rates, notifications, one liner quotes, jokes, appointments, bluetooth status, and much more, in 1 or 2 scrolling lines.
Purpose:
Many might have noticed too many of today plugin gives a scroll bar to your today screen which dont look good.
This is where this plugin comes in to picture.
This should be completely customizable right from scrolling speed to colors to information to flashing colors speed, bold and much more.
Language:
C++ is best language for this kind of project because of speed.
Database:
Not sure, but either SQL or Access DB.
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Project 5: Application Specific Backup Tool (Can be a great tool)
Not Sure if it exists or already available.
Added:
04 Feb 2008
Description:
There are several backup tools which takes backup of PPC as a whole and can be restored easily, but:
How many times you feel that you had installed tones of applications and had taken a backup of those, and now when you get a new PDA, you feel like you dont want to again install all the applications installed previously due to certain reasons. By restoring the backup you end up again with all unrequired applications again.
This tool will help you to eliminate those problems by taking backup of each and every application configurations seperately with version informations. Yes now you can backup configurations of your games, your theme managers, your music player configurations and everything and have choice to restore them back again seperately as required.
Yes people who develope tools with configurations involved may have to coporate to tell us where they save the data of their application so we coders can add a plugin code to backup that particular application.
You can say that this tool has a builtin database information of most of the application to backup the configs.
Purpose:
Description above says it all
Language:
C++ is best language for this kind of project because of speed.
Database:
Not sure, but either SQL or Access DB or XML
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------
Project 6: Application data which synchronizes with Web Services.
Not Sure if it exists or already available.
Added:
07 Feb 2008
Description:
Again this is an application which most coders are going to like who are learning mobile codings. This application mainly shows how to communicate with mobile device application with web service to keep data in sync. Data can be either contacts, games scores, or any text based details.
Yes a today screen plugin would be nice to show some information on sync or other details.
Purpose:
To provide generic code to each coder seeking this kind of communication.
Language:
C++ is best language for this kind of project because of speed.
And either .Net or Java for Web Services.
Database:
Not sure, but either SQL or Access DB or XML
Type:
Open Source
------------------------------------------------------------------------------------------------------------------
All Projects should be easily skinnable by anyone.
People willing to part of this project, than please post your details as follows:
Name:
Skills:
Comments:
Once we have a team than we will go ahead and create documents like
RUD (Requirement Understandings Document)
SRS (Software Requirement Specifications)
What do you guys say??
Wanna work together as one, and built a new world for everyone?
Wait for everyone's view, either good or bad.
I am not sure how good above to projects are, but this thread mainly wants every coder, designer, tester to work together and built something.
List of Contributers (Coders, Designer, Tester, Others)
This place will list all the Contributers (Coders, Designer, Tester, Others)
Screen Design for each Projects goes here
Screen designed by contributers goes in this post.
NOTE:All screens designed will be copyright of the designer and should not be distributed or used without a permission.
Attached a Screen for an idea for Project 4
Notice the first Plugin in Yellow border.
Created by me.
List of Features and Request for Features and Suggestions
List of Features and Request for Features and suggestions goes in this post whomsoever wants. Then the team can make it happen.
Builts / Releases
Builts / Releases Goes in this section.
Technical Disscutions
Important Technical Disscutions will be posted and collected in this post.
Intentionally kept blank 1
Intentionally kept blank 1
Intentionally kept blank 2
Intentionally kept blank 2
Intentionally kept blank 3
Intentionally kept blank 3
Intentionally kept blank 4
Intentionally kept blank 4
Intentionally kept blank 5
Intentionally kept blank 5
zbop has done something similar to what you are looking for in number 4. You place info in reg. keys and then update that info via Mortscript (or however you want) and then it gets scrolled on a today screen line. Check out http://discussion.treocentral.com/showthread.php?t=141375 post #269 for the latest version.
more than 600 views but just 1 reply!
I wonder how does open source developers meets and work together
I decided to give this initiative a fighting chance so I am going to 'sticky' this thread for one week.
If there are no takers I will 'unsticky' it.
Unfortunately, I do not currently have time to take part in this project my self as I am learning to program for Linux and OpenMoko specifically.
greenhacks said:
more than 600 views but just 1 reply!
I wonder how does open source developers meets and work together
Click to expand...
Click to collapse
They don't, they start by making something, small, runnable, interresting, then share it, with the source.
This is more than i could expect from this forum. Thanks a lot.
This is a try to bring many great people in this forum and to develop something great for the forum.
Projects mentioned in this thread is just for start.
People can give their own new ideas so all work together and make something great for all the forum users.
i have no other intentions to start this thread other then bringing all together.
Starting this thread i thought i will also put my skills to help new guys.
Thanks again, and i hope this works out.
Here's a project idea that came up in the herald forums - use your touchscreen as a psudo-wacom tablet while tethered. Yes it would only be on/off and wouldn't sense pressure differences, but would still make for a cool project.
Heared of Android?
I guess you have heared about android,an all open-source linux based platform.And about the total of 10M bounty by Google as an award for the top 50 applications tha will be developed for the platform.So I'm guessing any developers with the skills to do such projects will have their hands full.
After all it sould be reasonably easyer to programm for an all opensource platform than for WM,a closed source platform.
Just my 2 cents.
nstamoul said:
I guess you have heared about android,an all open-source linux based platform.And about the total of 10M bounty by Google as an award for the top 50 applications tha will be developed for the platform.So I'm guessing any developers with the skills to do such projects will have their hands full.
After all it sould be reasonably easyer to programm for an all opensource platform than for WM,a closed source platform.
Just my 2 cents.
Click to expand...
Click to collapse
Count the number of applications developed in this forum by everyone for so called 'closed source platform of wm6'
I do agree with your thoughts and dont say you are wrong, but hey thats a whole different ball game.
Always remember
When a company runs out of concepts, then company organises a competition with great prices. At the end company gets thousands of new concepts. winner gets the price, company gets new product.
same thing happens in open source world as well as close sourced.
If all think in this direction then i can bet, xda will run out of members.
not trying to defend, but this is something which simply cannot be debated or this is not a right place.
tene said:
They don't, they start by making something, small, runnable, interresting, then share it, with the source.
Click to expand...
Click to collapse
Then lets make something small, runnable, interresting, and share with the whole world!
It was very dificult to find this kind of groups, thats the reason internet became so famouse, where we can find different people with great skills from different country and make things possible.

C++: open file for writing in the LocalStorage

Hi guys, could you tell me how to open file for writing in the phone app LocalStorage for the non-unlocked handset (regular app for store)?
Code below doesn't work
Code:
FILE *tmp;
auto tmpPath = Windows::Storage::ApplicationData::Current->LocalFolder->Path + "\\tmp.txt";
auto tmpErr = _wfopen_s(&tmp, tmpPath->Data(), L"w");
Any suggestions?
Try looking though msdn articles. I found it somewhere in there. But I have forgotten it now.
Sent from Board Express on my Nokia Lumia 1020. Best phone ever!!
Note to noobs: DON'T PM ME WITH QUESTIONS. POST IN THE FORUMS. THAT'S WHAT THEY ARE HERE FOR!
@wcomhelp, please keep your rtfm advices for yourself, OK? I'm not a noob and of course I've searched msdn, google, codeplex, github etc. and so on before posting here. If you don't know how, much better be silent (like others who read this post but have no idea what I'm talking about)
I've tried a few possible methods including ugly "MS-way" with task & lambda syntax (see below) but nothing worked as it should be (code below works if no file exist and fails if file already exist - CreationCollisionOption::ReplaceExisting options is not worked/not implemented/buggy/billgates_knows_only ).
Code:
auto folder = Windows::Storage::ApplicationData::Current->LocalFolder;
Concurrency::task<Windows::Storage::StorageFile^> createFileOp(
folder->CreateFileAsync(CONFIG_FILE_NAME, Windows::Storage::CreationCollisionOption::ReplaceExisting));
createFileOp.then([=](Windows::Storage::StorageFile^ file)
{
return file->OpenAsync(Windows::Storage::FileAccessMode::ReadWrite);
})
.then([=](Windows::Storage::Streams::IRandomAccessStream^ stream)
{
auto outputStream = stream->GetOutputStreamAt(0);
auto dataWriter = ref new Windows::Storage::Streams::DataWriter(outputStream);
// data save code skipped
return dataWriter->StoreAsync();
})
.wait();
BTW, I've used workaround, to save ported C++ app data to the LocalSettings instead of text file (as it was in original code).
"Doesn't work" doesn't give us a lot to go on, troubleshooting-wise. Can you tell us what error you get?
Only thing I see in the code that looks a little weird is that the
Code:
"\\tmp.txt"
part isn't explicitly a wide-character string, but I'd expect string concatenation to take care of that.
Also, out of curiosity, why libc functions instead of Win32? Obviously, the code you're writing here isn't intended for much portability...
@GoodDayToDie, there is no error code at all - standard POSIX functions returns NULL FILE, the ::GetLastError() also return 0.
I'm porting old C-style app to WinRT platform and don't care about portability (but the first post code - just a simplified example, nothing more).
POSIX (libc) functions works pretty well for reading only but not for writing - that's the problem...
As I said before, I resolved my issue by workaround but still curious why the POSIX calls fails for file writing in the app storage.
buuuuuuuuuuuuuuuuh
No need for lambdas
https://paoloseverini.wordpress.com/2014/04/22/async-await-in-c/
You may also want to rethink your strategy
You can't create files at arbitrary locations, so your method is kinda redundant. All the locations you are allowed to create and read files to/from are available through KnowFolders and ApplicationData classes. These return StorageFolders which in turn can create files with CreateFileAsync (used for both creating and opening existing files) and get files with GetFilesAsync ( I recommend against this one though) and similar methods.
@mcosmin222, could you please re-read my posts one more time? I'm not trying to create files at "arbitrary locations"; I wanna create/write simple text file at the app's local storage (which one should be available for reading/writing). And the problem not in the lambdas or task usage (yes, it looks ugly but it works as it supposed to be).
Could you provide a working example instead of words? And I'll be glad to say you "thanks a lot"; can't say now...
sensboston said:
@mcosmin222, could you please re-read my posts one more time? I'm not trying to create files at "arbitrary locations"; I wanna create/write simple text file at the app's local storage (which one should be available for reading/writing). And the main problem not in the task (async execution).
Could you provide a working example instead of words? And I'll be glad to say you "thanks a lot"; can't say now...
Click to expand...
Click to collapse
Sure, just gimmie a few hours till I can get near a compiler that is capable of doing that
Of course, no rush at all, take your time. It's not a showstopper for me now (actually, my workaround with AppSettings is more preferable way - at least for universal app and roaming settings) but the issue still has an "academic interest" and maybe will be useful in the next projects for porting old C/C++ code to WinRT.
sensboston said:
Of course, no rush at all, take your time. It's not a showstopper for me now (actually, my workaround with AppSettings is more preferable way - at least for universal app and roaming settings) but the issue still has an "academic interest" and maybe will be useful in the next projects for porting old C/C++ code to WinRT.
Click to expand...
Click to collapse
hi
in vs 2015
#include <pplawait.h>
Something of the like should work
Code:
WriteSomeFile() __resumable
{
auto local = ApplicationData::Current->LocalFolder;
auto file = __await local->CreateFileAsync("some file", CreationCollisionOption::eek:penIfExists);
__await FileIO::WriteTextAsync(file, "this is some text");
}
However, as of right now, in VS 2015 RC, you have a host of limitations when dealing with this, but I do not believe this will be of any issue to you.
Code:
Cannot use Windows Runtime (WinRT) types in the signature of resumable function and resumable function cannot be a member function in a WinRT class. (This is fixed, but didn't make it in time for RC release)
We may give a wrong diagnostic if return statement appears in resumable function prior to seeing an await expression or yield statement. (Workaround: restructure your code so that the first return happens after yield or await)
Compiling code with resumable functions may result in compilation errors or bad codegen if compiled with /ZI flag (Edit and Continue debugging)
Parameters of a resumable function may not be visible while debugging
Please see this link for additional details
http://blogs.msdn.com/b/vcblog/archive/2015/04/29/more-about-resumable-functions-in-c.aspx
you should also note that this works with native, standard C++ types.
@mcosmin222, looks like unbuffered writing works (i.e. without streams) fine but it still not an answer for my initial question
I'm curious why the standard POSIX libc writing operations are not working on the app's local storage (but reading from files works fine). Actually, it's all about porting old C/C++ code for WinRT; of course for the new app it's not a problem but re-writing old code to FileIO should be a huge pain in the ass. What I did: I've "mechanically" changed all libc formatted outputs from file to string, and use LocalSettings class (actually it's XML file) to store that string (I'm planning also change LocalSettings to RoamingSettings, to provide settings consistency between WP & desktop app).
P.S. <pplawait.h> is not available in my VS 2015 (release pro version) so I've tested by using lambda pattern.
OK, first things first, LIBC != POSIX! The POSIX way to do this would be to call the open() function and get back an int as an "fd" (file descriptor), which is of course not implemented on Windows Phone because Windows Phone is not a POSIX platform (you might find the Windows compatibility functions _open() and _wopen(), but I doubt it). You are attempting to use the standard C library functions, which are portable but implement kind of a lowest common denominator of functionality and are generally slightly slower than native APIs because they go through a portability wrapper.
Second, sorry to be all RTFM on you but you should really Read The Manual (or manpage, or, since this is Windows, the MSDN page)! Libc APIs set errno (include errno.h) and use different error values than Windows system error codes (or HRESULT codes, or NTSTATUS codes, or...). Error reporting in C is a mess. If you were calling CreateFile(), you would check GetLastError(), but since you're calling _wfopen(), you check errno (not a function).
@GoodDayToDie, _wfopen_s returns 0 (i.e. "no error") but tmp pointer receives also 0 (NULL) Could you explain why libc file functions are working for reading (at the app installation & local data folders of course) but not for writing? Any logical ("msdn based") explanation? Or you just... don't know, heh?
sensboston said:
@GoodDayToDie, _wfopen_s returns 0 (i.e. "no error") but tmp pointer receives also 0 (NULL) Could you explain why libc file functions are working for reading (at the app installation & local data folders of course) but not for writing? Any logical ("msdn based") explanation? Or you just... don't know, heh?
Click to expand...
Click to collapse
LIBC functions will most likely work just in debug mode. The moment you try to publish the app it will fail. You can do lots of crazy stuff on your developer device with basic C functions, but if you try publishing, it won't pass the marketplace verification.
Most C APIs are simply not supported, since they do not comply with the sandbox environment of the Windows Runtime.
The code I gave you is tested with VS 2015 RC. You should be able to include <pplawait.h> just fine, if you are targeting toolchains newer than November 2013.
mcosmin222 said:
The moment you try to publish the app it will fail. You can do lots of crazy stuff on your developer device with basic C functions, but if you try publishing, it won't pass the marketplace verification.
Click to expand...
Click to collapse
Hmm... Are you sure or it's just your assumption? My app is still under development but (just for test!) I've made store app package for WP and it passed local store verification I also uploaded package to the store (via browser) and it also passed. I don't have time to create all tiles and fill all fields to complete beta-submission (actually, I don't know how to mark app as beta in the new dashboard) but for me it looks like app don't have any problem and will pass store certification easily. And you may be sure - it uses A LOT of libc calls 'cause originally it was written for Linux (or kind of UX system)
sensboston said:
Hmm... Are you sure or it's just your assumption? My app is still under development but (just for test!) I've made store app package for WP and it passed local store verification I also uploaded package to the store (via browser) and it also passed. I don't have time to create all tiles and fill all fields to complete beta-submission (actually, I don't know how to mark app as beta in the new dashboard) but for me it looks like app don't have any problem and will pass store certification easily. And you may be sure - it uses A LOT of libc calls 'cause originally it was written for Linux (or kind of UX system)
Click to expand...
Click to collapse
Once usage reports get up to microsoft, you will be given a notice to fix the offending API (happened to be once). You are much better off using the platform specific tools: not only they are much faster, they are also much safer and you won't have problems later on.
You might get away with reading stuff (since reading is not that harmful), but you should be using the winRT APIs each time they are available.
Simply uploading your app to the marketplace just reruns the local tests in their cloud servers: once you submit the actual app (not beta, not tests) for consumers, it will be much more aggressively checked. This is because the store allows specific scenarios for distributing apps in close circles that may break the usual validation rules.
@mcosmin222, one more time: is it your assumptions or personal experience? I don't know how many apps you have in store (I do have a lot) but I never heard that you said. I've used C++ libraries with WP hacks in some of published apps but never had any problem with "aggressive checks". What I know: if you are using some "prohibited" calls, your app will not pass uploading to the store (uploading, not a certification).
P.S. I'll send you personally a link when I publish release Hope, you'll like it
sensboston said:
@mcosmin222, one more time: is it your assumptions or personal experience? I don't know how many apps you have in store (I do have a lot) but I never heard that you said. I've used C++ libraries with WP hacks in some of published apps but never had any problem with "aggressive checks". What I know: if you are using some "prohibited" calls, your app will not pass uploading to the store (uploading, not a certification).
P.S. I'll send you personally a link when I publish release Hope, you'll like it
Click to expand...
Click to collapse
By "hacking" you mean recompiling the code to fit the windows phone toolchain? if so, then you shouldn't have to worry about too many things.
but even so, calling stuff like fopen in locations other than local storage will get your app banned. Even if it makes past the first publication, you can get noticed weeks later or even months (yes, it did happen to me personally).
In most cases, calling C APIs that can potentially break the sandbox (like opening a file in doc library with fopen) will always fail the marketplace verification, eventually. If it hasn't happened to you yet, then you may have not been using such APIs.
No, my C++ code is not accessing other than approved locations but the app has a lot of libс (and of course other C/C++ libs) calls; I'm 99.9% sure it's legitimate and will be not a source of any problem. Otherwise what is the advantages of having C++ compiler?!
As far as I know, just some of API's are prohibited but you will notice it right after local store compatibility test run...
As for "hacks" I mean usage of undocumented ShellChromeAPI calls (including loading hack).
P.S. I've found why <pplawait.h> header is missing. Initially I've created solution with the 12.0 toolset but now I can't (or don't know how to) change it to 14. However creating the new empty universal solution in VS 2015 also gives me toolset 12 by default. What is the toolset 14 for? Windows 10?
sensboston said:
No, my C++ code is not accessing other than approved locations but the app has a lot of libс (and of course other C/C++ libs) calls; I'm 99.9% sure it's legitimate and will be not a source of any problem. Otherwise what is the advantages of having C++ compiler?!
As far as I know, just some of API's are prohibited but you will notice it right after local store compatibility test run...
As for "hacks" I mean usage of undocumented ShellChromeAPI calls (including loading hack).
P.S. I've found why <pplawait.h> header is missing. Initially I've created solution with the 12.0 toolset but now I can't (or don't know how to) change it to 14. However creating the new empty universal solution in VS 2015 also gives me toolset 12 by default. What is the toolset 14 for? Windows 10?
Click to expand...
Click to collapse
The advantage of C++ is the obvious versatility: the standard C++ APIs will work fine for you as long as you stay inside the sandbox (this means you can't access files even in locations that are outside of sandbox but you have permission to them, such as music library). You can use most classic C/C++ libraries without issues as long as you do the interface with the runtime broker yourself. That means using windows runtime APIs instead of classic C APIs when dealing with stuff such as file access, for example. This is a pretty extensive topic and It is rather difficult to explain it all with 100% accuracy, especially when there is lots of docs running around.
You also get deterministic memory management, which is huge in specific scenarios.
Long story short
You will be fine with standard C/C++ when using
any in-memory functions supported by the compiler (you can manipulate data types, string, mutex, etc).
File IO in isolated storage only (applicationData folder)
Threads (although you are better off using threadpool or the like, it is much easier and cleaner). You can also use futures, and std::this_thread.
You will have to use winRT replacement
File system access in any other location than application data (you must use the windows::storage APIs)
sockets, internet access and the like.
any hardware related thing: music&video playerback must be interfaced through winRT (although the underlying decoders can be classic C/C++), messing around with the device sensors.
Retrieving system properties (internet connection state etc)
cross process communications
communicating with other apps
There are also win32 equivalents
mutex, threading, fileIO (isolated storage only)
Media playback with custom rendering pipeline.
Basically, winRT functions as an abstraction layer between the hardware and your code. You can use classic C++ up to the point where you need to interact with the system in any way. At that point, system interaction must be done with winRT. This way, microsoft ensures a higher degree of stability and security for devices.
check this link out for more information on the toolchains. You should be able to use this in VS 2013 as well with windows 8 (this is a compiler feature, has nothing to do with supported platform)
https://paoloseverini.wordpress.com/2014/04/22/async-await-in-c/

RTL smartwatch change os- editor?

Hi i have Microwear U9 use RTL8762D cpu and Mactivepro app. is it possible to change os or have watchface editor?
attach an any watch face file to understanding format of it. too much chinesse models but mostly just a clones of each other.
How can i learn watchface file format?
actually it's a complex task.
- at first, you must be able to write some peace of code, at least to disassemble/assemble watch face file ("wf" below). you not required to be a super programmer, but ability to write little app you must have. of course editor with gui wold be more preffer
- you must separate frame (image) blocks (even without decoding for beginning), to understanding where it begins and where it finishes. not for each frame, but you must investigate a logic of a placement.
- you must find the pointers to frame blocks
- investigate structure of frame block descriptions
- now you may try to decode frames
- analyze header structure
- make a simple viewer for this format and try to use it for as many compatible wf'ses as it's possible, to be sure what you can read it all correctly
- try to make a writer and test your results
- polish the editor.
a good practice is a learn an any already described formats, even not compatible. at least you'll got a basic understanding how it works. for sample, I'd described one of the easiest here https://forum.xda-developers.com/t/...face-structure-direct-connect-via-bt.4502303/ read an "about watchfaces" spoiler.
if you still want to investigate a wf format of your watch, I will give you some cues/hints/helps, but would not make all of it for you.

Categories

Resources