How to access Database file from SD card in j2me - java-me

I am new in J2ME. In my Application, I have to store a large amount of data in Database and have to access it.
But with the limitation of RMS in J2ME, I can't store large amount of data.
Is there any way to access database file from External Storage(SD card)?

I am partially agree with funkybro, i.e. you can not save your RMS in to SDCard.
You can also use Files to store your data. but should be last option.
Here i am suggesting you an another option, i.e. install your application on SD-Card and then user. This way your RMS will be created on Memory card, so no space issue will arise. But the problem you may face shall be if you are using this application on s40 Series device then your heap memory will be limited to 2MB. Your application may crash during execution. If you are using s60 series device, it will work fine.
I also want you to look at my this answer for more information.

If you are really asking "can I make RMS save to the SD card", the answer is NO you have no control over where the device persists RMS data.
You would need to use JSR-75 to save data on the SD card in your own format.

Related

find a video file in memory dump of a process

I have a player that plays encrypted video files and works like this:
I open an encrypted video file with it
it decrypts the video file and writes it to its memory
and plays the file from the memory after that
and I want to copy the decrypted video file from memory and play it with a usual video player like VLC so I tried to create its memory dump with task manager and hoped to find out the video file there. Sadly I don't know enough to find a video file in a large chunk of bits from memory. I tried to find mp4 patterns in a hex editor and done every solution that I find online but nothing worked for me so I hoped someone here maybe has an idea and willing to help me how to make it done.
I upload its memory dump here (after opening a short encrypted video with it)
Most probably, the software doesn't decode whole video file in one go, but instead in streaming fashion. This makes it impossible to catch a moment when the decoded video data is available in the memory dump.
If the player software is open source, compile it with debug symbols and run it under debugger. Otherwise, resort to reverse engineering.
I don't think the question is on-topic for StackOverflow in general, including but not limited to specifically reversing a software solution intended for digital rights management. However I would still leave an answer.
First of all, as comments suggest the topic in question is reversal of specific solution provided by a commercial provider. Ability to recover a media file from memory dump highly depends on implementation of this solution and methods the provider used to complicate the reversal. It is only the simplest and straightforward solution is easy to reverse and the more developer put in to cover traces, the harder - exponentially - is to reverse.
Even though there is a little chance to find the original file in full in memory (through memory dump analysis) it is unlikely to be possible for any media playback application, even such that does not do any decryption. Media playback is typically streaming: the data is loaded from disk, storage, network etc. as necessary for playback and not as a full download. Decryption needs to be applied to certain pieces of data needed momentarily, and then a decent DRM-enabled application would immediately erase the ephemeral clear data once it is no longer needed. That is, a memory dump would - at best - contain a ridiculously small amount of media data.
To capture/restore the original media file one would typically have to place himself as a middleman into some media streaming related process and be able to copy data as it is being streaming durign playback. A static memory dump is of little help here.

which is better to use in v4l2 framework, user pointer or mmap

After going through these links,
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/userp.html
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/mmap.html
I understood that there are two ways to create a buffer in v4l2 framework
Userpointer buffer: buffer will be created in user space.
Memory buffer: Buffer will be created in kernel space.
I have bit confused, which one to use while doing v4l2 driver development. I mean, which is better approach in terms of performance and handling buffer?
I will be using DMS-SG for data transfer in my hardware.
It depends.. on your requirements.
Case: Visualization of the video stream.
In this case, you might want to write the video data directly to memory that is accessible to the video driver, saving a copy operation. You will also get the shortest camera-to-display time. In this case, a user pointer would be the go to.
Case: Recording of the video stream.
In this case, you do not care about the timely delivery, but you do care about not missing frames. In this case, you can use memory mapped acquisition with multiple buffers.
Case: Single image acquisition for processing.
In this case, both timely delivery and missing frames are both less important, so you could use either method, but buffered operation will give the fastest acquisition time, since there is always a buffer with recent image data available.

Usb key with no file system (raw space)?

I am wondering if it is possible to have a usb key in a raw format and still read/write files on it.
It should be cross-platform and understood by a dedicated software we ship.
I am kind of creating a non-bootable file system in a hurry, and I just need to read/write some values at some offsets on this raw storage space.
People who will use it will be shipped the software able to read those values (not the operating system who will surely see raw/free space, but we don't care about that).
Will I run into troubles with the mounting, or whatever?
Or is it green light?
Thanks
Yes, absolutely, you can read and write the "unformatted" SD card or USB memory. You can also format it to whatever filesystem you need by writing to pages of that memory. The only possible difficulty is that the OS (at least later Windows versions) might not allow writing to the disk if the user account doesn't have admin rights.

What happens to data persisted with RMS if I shutdown the device

I need to save some data in my j2me application using RMS, but I'm not sure about what happens to this data if I shutdown the phone or if the it runs of out battery. Next time I start the phone, will the data be still there??
Just one more question, do you know where the data persisted with RMS goes(phone memory or a memory card)?
Thanks in advance.
This might answer your question:
A class representing a record store. A record store consists of a collection of records which will remain persistent across multiple invocations of the MIDlet. The platform is responsible for making its best effort to maintain the integrity of the MIDlet's record stores throughout the normal use of the platform, including reboots, battery changes, etc.
Source.
Data stored in RMS is persistent. In other words, it stays there even after removing the battery, just like the installed apps stay there.
RMS data is stored in phone memory.

Purposefully Corrupting a FAT File System?

Is there a way to purposefully corrupt a FAT file system using only Win32 calls or must you do it at lower level? We're encountering FAT corruption on a WinCE 5.0 device and have written a utility to detect and attempt to correct it, but don't have a means to create FAT corruption on demand. Thanks.
The media is a CF card, but it's not removable as a normal course as it's mounted internal to the device.
What's the FAT on (e.g. inserted USB, on-board flash, etc)? That's going to make a large difference.
If it's the on-board flash, you need to get underneath the file system driver (FSD), which is typically going to be the flash driver itself. It's going to have access to the raw flash sectors (it's what the FSD uses for its reads and writes) either through Xxx_Write or Xxx_Ioctl. Exactly how it works is going to depend on the flash driver in use, so looking at the driver source is your best path.
You can access device data as a raw file and write random data in that file to corrupt FAT. E.g. if you write random data on:
\?\Device\HarddiskVolume1
This would corrupt first partition.
This page has some hints on how to figure out paths for HDD/USB drive etc.
http://www.chrysocome.net/dd

Resources